You've already forked community.general
mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 07:41:16 +03:00
Fix AZP CI (#1508)
* Fix 2.9/2.10 cloud * Fix splunk callback tests. * ansible_virtualization_type on AZP can be one of container/containerd instead of docker for dockerized tests. * Disable nomad tests. * Work around AZP bugs.
This commit is contained in:
@ -25,7 +25,10 @@ import json
|
||||
|
||||
|
||||
class TestSplunkClient(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@patch('ansible_collections.community.general.plugins.callback.splunk.socket')
|
||||
def setUp(self, mock_socket):
|
||||
mock_socket.gethostname.return_value = 'my-host'
|
||||
mock_socket.gethostbyname.return_value = '1.2.3.4'
|
||||
self.splunk = SplunkHTTPCollectorSource()
|
||||
self.mock_task = Mock('MockTask')
|
||||
self.mock_task._role = 'myrole'
|
||||
@ -46,6 +49,8 @@ class TestSplunkClient(unittest.TestCase):
|
||||
sent_data = json.loads(args[1])
|
||||
|
||||
self.assertEqual(sent_data['event']['timestamp'], '2020-12-01 00:00:00.000000 +0000')
|
||||
self.assertEqual(sent_data['event']['host'], 'my-host')
|
||||
self.assertEqual(sent_data['event']['ip_address'], '1.2.3.4')
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.callback.splunk.datetime')
|
||||
@patch('ansible_collections.community.general.plugins.callback.splunk.open_url')
|
||||
@ -59,3 +64,5 @@ class TestSplunkClient(unittest.TestCase):
|
||||
sent_data = json.loads(args[1])
|
||||
|
||||
self.assertEqual(sent_data['event']['timestamp'], '2020-12-01 00:00:00 +0000')
|
||||
self.assertEqual(sent_data['event']['host'], 'my-host')
|
||||
self.assertEqual(sent_data['event']['ip_address'], '1.2.3.4')
|
||||
|
Reference in New Issue
Block a user