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:
Felix Fontein 2020-12-18 11:48:28 +01:00 committed by GitHub
parent 33126b7267
commit dd55c3c3bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 8 deletions

View file

@ -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')