diff --git a/src/pushsource/_impl/backend/pub_source/pub_client.py b/src/pushsource/_impl/backend/pub_source/pub_client.py index dd090edc..cb17d8ce 100644 --- a/src/pushsource/_impl/backend/pub_source/pub_client.py +++ b/src/pushsource/_impl/backend/pub_source/pub_client.py @@ -43,19 +43,25 @@ def _session(self): self._tls.session = requests.Session() return self._tls.session - def _do_request(self, **kwargs): - return self._session.request(**kwargs) + def _do_request(self, url, **kwargs): + kwargs["url"] = url.format(filename="images.json") + resp = self._session.request(**kwargs) + # if 404 lets try clouds.json + if resp.status_code == 404: + kwargs["url"] = url.format(filename="clouds.json") + resp = self._session.request(**kwargs) + return resp def get_ami_json_f(self, task_id): """ Returns Future[dict|list] holding json obj with AMI push items returned from Pub for given task id. """ endpoint = "pub/task" - url_ending = "log/images.json" + url_ending = "log/{filename}" params = {"format": "raw"} url = os.path.join(self._url, endpoint, str(task_id), url_ending) - LOG.info("Requesting Pub service for %s of task: %s", url_ending, str(task_id)) + LOG.info("Fetching AMI details from Pub task: %s", str(task_id)) ft = self._executor.submit( self._do_request, method="GET", url=url, params=params ) diff --git a/src/pushsource/_impl/model/ami.py b/src/pushsource/_impl/model/ami.py index 8d19ca36..694d42d8 100644 --- a/src/pushsource/_impl/model/ami.py +++ b/src/pushsource/_impl/model/ami.py @@ -224,8 +224,8 @@ def _from_data(cls, data): "origin": data.get("origin") or None, # ami push item fields "release": AmiRelease._from_data(data.get("release") or {}), - "type": data["type"], - "region": data["region"], + "type": data.get("type") or None, + "region": data.get("region") or None, "virtualization": data["virtualization"], "volume": data["volume"], "root_device": data["root_device"], @@ -236,8 +236,10 @@ def _from_data(cls, data): "boot_mode": ( BootMode(data.get("boot_mode")) if data.get("boot_mode") else None ), - "billing_codes": AmiBillingCodes._from_data( - data.get("billing_codes") or {} + "billing_codes": ( + AmiBillingCodes._from_data(data.get("billing_codes")) + if data.get("billing_codes") + else None ), "image_id": data.get("ami") or None, "public_image": data.get("public_image"), diff --git a/tests/pub/data/123456/clouds.json b/tests/pub/data/123456/clouds.json new file mode 100644 index 00000000..cbd1bd54 --- /dev/null +++ b/tests/pub/data/123456/clouds.json @@ -0,0 +1,139 @@ +[ + { + "boot_mode": null, + "build": "rhel-sap-ec2-8.8-2116", + "build_info": { + "id": 3176889, + "name": "rhel-sap-ec2", + "release": "2116", + "version": "8.8" + }, + "description": "Provided by Red Hat, Inc.", + "dest": [ + "test-dest" + ], + "ena_support": true, + "image_id": "ami-test", + "marketplace_entity_type": "AmiProduct", + "md5sum": "0ef2038e599967f7074b6c52e5b2afae", + "name": "rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "recommended_instance_type": "t2.micro", + "release": { + "arch": "x86_64", + "base_product": null, + "base_version": null, + "date": "20240717", + "product": "RHEL-SAP", + "respin": 2116, + "type": null, + "variant": null, + "version": "8.8" + }, + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "src": "/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "sriov_net_support": "simple", + "starmap_query": { + "clouds": { + "aws-emea": [ + { + "architecture": "x86_64", + "destination": "test-dest", + "id": null, + "meta": { + "description": "Provided by Red Hat Limited.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ], + "aws-na": [ + { + "architecture": "x86_64", + "destination": "test-dest2", + "id": null, + "meta": { + "description": "Provided by Red Hat, Inc.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ] + }, + "name": "rhel-sap-ec2", + "workflow": "stratosphere" + }, + "state": "PUSHED", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + } +] \ No newline at end of file diff --git a/tests/pub/data/200/clouds.json b/tests/pub/data/200/clouds.json new file mode 100644 index 00000000..48aad6c8 --- /dev/null +++ b/tests/pub/data/200/clouds.json @@ -0,0 +1,322 @@ +[ + { + "boot_mode": null, + "build": "rhel-sap-ec2-8.8-2116", + "build_info": { + "id": 3176889, + "name": "rhel-sap-ec2", + "release": "2116", + "version": "8.8" + }, + "description": "Provided by Red Hat, Inc.", + "dest": [ + "test-dest" + ], + "ena_support": true, + "image_id": "ami-test", + "marketplace_entity_type": "AmiProduct", + "md5sum": "0ef2038e599967f7074b6c52e5b2afae", + "name": "rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "recommended_instance_type": "t2.micro", + "release": { + "arch": "x86_64", + "base_product": null, + "base_version": null, + "date": "20240717", + "product": "RHEL-SAP", + "respin": 2116, + "type": null, + "variant": null, + "version": "8.8" + }, + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "src": "/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "sriov_net_support": "simple", + "starmap_query": { + "clouds": { + "aws-emea": [ + { + "architecture": "x86_64", + "destination": "test-dest", + "id": null, + "meta": { + "description": "Provided by Red Hat Limited.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ], + "aws-na": [ + { + "architecture": "x86_64", + "destination": "test-dest2", + "id": null, + "meta": { + "description": "Provided by Red Hat, Inc.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ] + }, + "name": "rhel-sap-ec2", + "workflow": "stratosphere" + }, + "state": "PUSHED", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + { + "boot_mode": null, + "build": "rhel-sap-ec2-8.8-2116", + "build_info": { + "id": 3176889, + "name": "rhel-sap-ec2", + "release": "2116", + "version": "8.8" + }, + "description": "Provided by Red Hat, Inc.", + "dest": [ + "test-dest2" + ], + "ena_support": true, + "image_id": "ami-test", + "marketplace_entity_type": "AmiProduct", + "md5sum": "0ef2038e599967f7074b6c52e5b2afae", + "name": "rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "recommended_instance_type": "t2.micro", + "release": { + "arch": "x86_64", + "base_product": null, + "base_version": null, + "date": "20240717", + "product": "RHEL-SAP", + "respin": 2116, + "type": null, + "variant": null, + "version": "8.8" + }, + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "src": "/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + "sriov_net_support": "simple", + "starmap_query": { + "clouds": { + "aws-emea": [ + { + "architecture": "x86_64", + "destination": "test-dest", + "id": null, + "meta": { + "description": "Provided by Red Hat Limited.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ], + "aws-na": [ + { + "architecture": "x86_64", + "destination": "test-dest2", + "id": null, + "meta": { + "description": "Provided by Red Hat, Inc.", + "ena_support": true, + "marketplace_entity_type": "AmiProduct", + "recommended_instance_type": "t2.micro", + "release_notes": "Fake release notes", + "root_device": "/dev/sda1", + "scanning_port": 22, + "security_groups": [ + { + "from_port": 22, + "ip_protocol": "tcp", + "ip_ranges": [ + "0.0.0.0/0" + ], + "to_port": 22 + } + ], + "sharing_accounts": [ + "tester" + ], + "sriov_net_support": "simple", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + "overwrite": false, + "provider": null, + "restrict_major": null, + "restrict_minor": null, + "restrict_version": true, + "tags": {} + } + ] + }, + "name": "rhel-sap-ec2", + "workflow": "stratosphere" + }, + "state": "PUSHED", + "usage_instructions": "Fake use instructions", + "user_name": "Fake-Username", + "virtualization": "hvm", + "volume": "gp2" + }, + { + "billing_codes": { + "codes": [ + "bp-fake" + ], + "name": "Hourly2" + }, + "boot_mode": null, + "build": "rhel-ec2-8.8-2175", + "build_info": { + "id": 3176891, + "name": "rhel-ec2", + "release": "2175", + "version": "8.8" + }, + "description": "Provided by Red Hat, Inc.", + "dest": [ + "testb" + ], + "ena_support": true, + "image_id": "ami-test", + "marketplace_entity_type": "ACN", + "md5sum": "tester", + "name": "rhel-ec2-8.8-2175.x86_64.raw.xz", + "public_image": true, + "region": "cn-north-1", + "release": { + "arch": "x86_64", + "base_product": null, + "base_version": null, + "date": "20240717", + "product": "RHEL", + "respin": 2175, + "type": "ga", + "variant": "BaseOS", + "version": "8.8" + }, + "root_device": "/dev/sda1", + "security_groups": [], + "src": "/test/path/packages/rhel-ec2/8.8/2175/images/rhel-ec2-8.8-2175.x86_64.raw.xz", + "sriov_net_support": "simple", + "state": "PUSHED", + "type": "hourly", + "virtualization": "hvm", + "volume": "gp3" + } +] \ No newline at end of file diff --git a/tests/pub/test_pub_amis.py b/tests/pub/test_pub_amis.py index 7963c4aa..633cf8c3 100644 --- a/tests/pub/test_pub_amis.py +++ b/tests/pub/test_pub_amis.py @@ -17,8 +17,8 @@ DATAPATH = os.path.join(os.path.dirname(__file__), "data") -def make_response(task_id): - with open(os.path.join(DATAPATH, str(task_id), "images.json")) as f: +def make_response(task_id, filename="images.json"): + with open(os.path.join(DATAPATH, str(task_id), filename)) as f: return json.load(f) @@ -96,6 +96,189 @@ def test_get_ami_push_items_single_task(requests_mock): ] +def test_get_ami_push_items_single_task_clouds(requests_mock): + """ + Tests getting push item from one Stratosphere Pub task. + """ + # test setup + task_id = 123456 + pub_url = "https://pub.example.com" + request_url = os.path.join( + pub_url, "pub/task", str(task_id), "log/clouds.json?format=raw" + ) + + requests_mock.register_uri( + "GET", request_url, json=make_response(task_id, "clouds.json") + ) + + # Add 404 for images.json + request_url = os.path.join( + pub_url, "pub/task", str(task_id), "log/images.json?format=raw" + ) + requests_mock.register_uri("GET", request_url, status_code=404) + + # request push items from source + with Source.get("pub:%s" % pub_url, task_id=task_id) as source: + push_items = [item for item in source] + + # there should be exactly one push item + assert len(push_items) == 1 + + # with following content + assert push_items == [ + AmiPushItem( + name="rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + state="PENDING", + src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + dest=["test-dest"], + release=AmiRelease( + product="RHEL-SAP", + date="20240717", + arch="x86_64", + respin=2116, + version="8.8", + ), + description="Provided by Red Hat, Inc.", + virtualization="hvm", + volume="gp2", + root_device="/dev/sda1", + sriov_net_support="simple", + ena_support=True, + release_notes="Fake release notes", + usage_instructions="Fake use instructions", + recommended_instance_type="t2.micro", + marketplace_entity_type="AmiProduct", + scanning_port=22, + user_name="Fake-Username", + security_groups=[ + AmiSecurityGroup( + from_port=22, ip_protocol="tcp", ip_ranges=["0.0.0.0/0"], to_port=22 + ), + ], + ) + ] + + +def test_get_ami_push_items_rhcos_task_cloud(requests_mock): + """ + Tests getting push item from one Stratosphere RHCOS Pub task. + """ + # test setup + task_id = 200 + pub_url = "https://pub.example.com" + request_url = os.path.join( + pub_url, "pub/task", str(task_id), "log/clouds.json?format=raw" + ) + + requests_mock.register_uri( + "GET", request_url, json=make_response(task_id, "clouds.json") + ) + + # Add 404 for images.json + request_url = os.path.join( + pub_url, "pub/task", str(task_id), "log/images.json?format=raw" + ) + requests_mock.register_uri("GET", request_url, status_code=404) + + # request push items from source + with Source.get("pub:%s" % pub_url, task_id=task_id) as source: + push_items = [item for item in source] + + # there should be this many push items + assert len(push_items) == 3 + + # with following content + assert push_items == [ + AmiPushItem( + name="rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + state="PENDING", + src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + dest=["test-dest"], + release=AmiRelease( + product="RHEL-SAP", + date="20240717", + arch="x86_64", + respin=2116, + version="8.8", + ), + description="Provided by Red Hat, Inc.", + virtualization="hvm", + volume="gp2", + root_device="/dev/sda1", + sriov_net_support="simple", + ena_support=True, + release_notes="Fake release notes", + usage_instructions="Fake use instructions", + recommended_instance_type="t2.micro", + marketplace_entity_type="AmiProduct", + scanning_port=22, + user_name="Fake-Username", + security_groups=[ + AmiSecurityGroup( + from_port=22, ip_protocol="tcp", ip_ranges=["0.0.0.0/0"], to_port=22 + ), + ], + ), + AmiPushItem( + name="rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + state="PENDING", + src="/test/path/packages/rhel-sap-ec2/8.8/2116/images/rhel-sap-ec2-8.8-2116.x86_64.raw.xz", + dest=["test-dest2"], + release=AmiRelease( + product="RHEL-SAP", + date="20240717", + arch="x86_64", + respin=2116, + version="8.8", + ), + description="Provided by Red Hat, Inc.", + virtualization="hvm", + volume="gp2", + root_device="/dev/sda1", + sriov_net_support="simple", + ena_support=True, + release_notes="Fake release notes", + usage_instructions="Fake use instructions", + recommended_instance_type="t2.micro", + marketplace_entity_type="AmiProduct", + scanning_port=22, + user_name="Fake-Username", + security_groups=[ + AmiSecurityGroup( + from_port=22, ip_protocol="tcp", ip_ranges=["0.0.0.0/0"], to_port=22 + ), + ], + ), + AmiPushItem( + name="rhel-ec2-8.8-2175.x86_64.raw.xz", + state="PENDING", + src="/test/path/packages/rhel-ec2/8.8/2175/images/rhel-ec2-8.8-2175.x86_64.raw.xz", + dest=["testb"], + release=AmiRelease( + product="RHEL", + date="20240717", + arch="x86_64", + variant="BaseOS", + respin=2175, + version="8.8", + type="ga", + ), + description="Provided by Red Hat, Inc.", + type="hourly", + region="cn-north-1", + virtualization="hvm", + volume="gp3", + root_device="/dev/sda1", + sriov_net_support="simple", + ena_support=True, + billing_codes=AmiBillingCodes(name="Hourly2", codes=["bp-fake"]), + marketplace_entity_type="ACN", + public_image=True, + security_groups=[], + ), + ] + + def test_get_ami_push_items_multiple_tasks(requests_mock): """ Tests getting push items for multiple Pub tasks. @@ -299,6 +482,11 @@ def test_pub_source_invalid_task_id(requests_mock, caplog): requests_mock.register_uri("GET", request_url, json=make_response(123456)) + request_clouds_url = os.path.join( + pub_url, "pub/task", "1234567890", "log/clouds.json?format=raw" + ) + requests_mock.register_uri("GET", request_clouds_url, status_code=404) + # request push items from source with Source.get("pub:%s" % pub_url, task_id=task_id) as source: push_items = [item for item in source] @@ -323,6 +511,11 @@ def test_pub_source_empty_response(requests_mock, caplog): requests_mock.register_uri("GET", request_url, json={}) + request_clouds_url = os.path.join( + pub_url, "pub/task", "1234567890", "log/clouds.json?format=raw" + ) + requests_mock.register_uri("GET", request_clouds_url, status_code=404) + with Source.get("pub:%s" % pub_url, task_id=task_id) as source: push_items = [item for item in source] @@ -341,11 +534,15 @@ def test_pub_source_missing_task(requests_mock, caplog): caplog.set_level(logging.WARNING) task_id = 1234567890 pub_url = "https://pub.example.com" - request_url = os.path.join( + request_images_url = os.path.join( pub_url, "pub/task", "1234567890", "log/images.json?format=raw" ) + requests_mock.register_uri("GET", request_images_url, status_code=404) - requests_mock.register_uri("GET", request_url, status_code=404) + request_clouds_url = os.path.join( + pub_url, "pub/task", "1234567890", "log/clouds.json?format=raw" + ) + requests_mock.register_uri("GET", request_clouds_url, status_code=404) # request push items - 404 received raises exception with pytest.raises(requests.exceptions.HTTPError) as exc: diff --git a/tests/pub/test_pub_client.py b/tests/pub/test_pub_client.py index 6741869c..e1eab6bb 100644 --- a/tests/pub/test_pub_client.py +++ b/tests/pub/test_pub_client.py @@ -35,7 +35,7 @@ def test_pub_client_successful_request(requests_mock, caplog, test_client): assert json_ft.result() == {"test": "OK"} # following lines are captured in logs assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 200", ] @@ -62,7 +62,7 @@ def test_pub_client_corrupted_json(requests_mock, caplog, test_client): assert json_ft.result() == None # following lines are captured in logs assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 200", ] @@ -80,6 +80,10 @@ def test_pub_client_404_status(requests_mock, caplog, test_client): url, "pub/task", str(task_id), "log/images.json?format=raw" ) requests_mock.register_uri("GET", request_url, text="Not Found", status_code=404) + request_url = os.path.join( + url, "pub/task", str(task_id), "log/clouds.json?format=raw" + ) + requests_mock.register_uri("GET", request_url, text="Not Found", status_code=404) # do request to service - 404 raises exception with pytest.raises(requests.exceptions.HTTPError) as exc: @@ -89,15 +93,18 @@ def test_pub_client_404_status(requests_mock, caplog, test_client): # following lines are captured in logs - more line due to retries assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 404", + "GET https://test.example.com/pub/task/100/log/clouds.json?format=raw 404", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 404", + "GET https://test.example.com/pub/task/100/log/clouds.json?format=raw 404", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 404", + "GET https://test.example.com/pub/task/100/log/clouds.json?format=raw 404", ] # check exception value assert ( - "404 Client Error: None for url: https://test.example.com/pub/task/100/log/images.json?format=raw" + "404 Client Error: None for url: https://test.example.com/pub/task/100/log/clouds.json?format=raw" in str(exc.value) ) @@ -125,7 +132,7 @@ def test_pub_client_500_status(requests_mock, caplog, test_client): # following lines are captured in logs - more line due to retries assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 500", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 500", @@ -162,7 +169,7 @@ def test_pub_client_500_status(requests_mock, caplog, test_client): # following lines are captured in logs - more line due to retries assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 500", "GET https://test.example.com/pub/task/100/log/images.json?format=raw 500", @@ -197,6 +204,6 @@ def test_pub_client_timeout_error(requests_mock, caplog, test_client): # following lines are captured in log. assert caplog.messages == [ - "Requesting Pub service for log/images.json of task: 100", + "Fetching AMI details from Pub task: 100", "Creating requests Session for client of Pub service: https://test.example.com/", ]