mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 15:29:10 -07: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:
parent
33126b7267
commit
dd55c3c3bb
5 changed files with 19 additions and 8 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue