datadog-api-client-python icon indicating copy to clipboard operation
datadog-api-client-python copied to clipboard

get_api_test() fails when there are wait steps in API Synthetics test

Open manojkunja opened this issue 1 year ago • 1 comments

Describe the bug get_api_test() gets the synthetic api test when there are no wait steps involved in the Synthetic API test, but when we add a wait step it starts to fail with TypeError: _from_openapi_data() missing 1 required positional argument: 'request'

Label the issue properly.

  • Add severity/ label.
  • Add documentation label if this issue is related to documentation changes.

To Reproduce Steps to reproduce the behavior:

  1. Go to Synthetics
  2. Create a multi step synthetic test
  3. Add some requests and atleast one wait step.
  4. Try to get that api test using the datadog api client. Notice that we hit this error.

Expected behavior We should be able to get the test data irrespective of the steps.

Screenshots image

Environment and Versions (please complete the following information): Python 3.9.16 datadog==0.45.0 datadog-api-client==2.24.0

Additional context Error: Traceback (most recent call last): File "tenableio/commandline/synthetics_api.py", line 502, in <module> synth.create_synthetic_test(sites=sites, flow=flow, attrib=[template_tag]) File "tenableio/commandline/synthetics_api.py", line 361, in create_synthetic_test self.build_tests(site, flow, variable_id_map[site], attrib) File "tenableio/commandline/synthetics_api.py", line 252, in build_tests response = self.get_synthetic_test(self.public_id_map[flow]) File "tenableio/commandline/synthetics_api.py", line 180, in get_synthetic_test response = api_instance.get_api_test( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/v1/api/synthetics_api.py", line 853, in get_api_test return self._get_api_test_endpoint.call_with_http_info(**kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/api_client.py", line 712, in call_with_http_info return self.api_client.call_api( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/api_client.py", line 326, in call_api return self._call_api( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/api_client.py", line 129, in _call_api return_data = self.deserialize(response_data, response_type, check_type) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/api_client.py", line 219, in deserialize deserialized_data = validate_and_convert_types( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1593, in validate_and_convert_types return attempt_convert_item( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1484, in attempt_convert_item return deserialize_model( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1403, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 42, in wrapped_init return fn(_self, *args, **kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 341, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/synthetics_api_test.py", line 110, in _from_openapi_data self.config = config File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 196, in __setattr__ self[attr] = value File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 567, in __setitem__ self.set_attribute(name, value) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 165, in set_attribute value = validate_and_convert_types( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1593, in validate_and_convert_types return attempt_convert_item( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1484, in attempt_convert_item return deserialize_model( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1403, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 42, in wrapped_init return fn(_self, *args, **kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 341, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/synthetics_api_test_config.py", line 58, in _from_openapi_data self = super(SyntheticsAPITestConfig, cls)._from_openapi_data(kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 642, in _from_openapi_data setattr(self, var_name, var_value) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 196, in __setattr__ self[attr] = value File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 567, in __setitem__ self.set_attribute(name, value) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 165, in set_attribute value = validate_and_convert_types( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1639, in validate_and_convert_types validate_and_convert_types( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1593, in validate_and_convert_types return attempt_convert_item( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1484, in attempt_convert_item return deserialize_model( File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 1403, in deserialize_model return model_class._new_from_openapi_data(**kw_args) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 42, in wrapped_init return fn(_self, *args, **kwargs) File "/Users/mkunja/repos/catium-tenableio/venv/lib/python3.8/site-packages/datadog_api_client/model_utils.py", line 341, in _new_from_openapi_data return cls._from_openapi_data(*args, **kwargs) TypeError: _from_openapi_data() missing 1 required positional argument: 'request'

Code:

with ApiClient(self.configuration) as api_client:
            api_instance = SyntheticsApi(api_client)
            response = api_instance.get_api_test(
                public_id=test_id
            )

manojkunja avatar May 17 '24 01:05 manojkunja

I just noticed that update_api_test and create_synthetics_api_test also have same issue . While creating or updating an api synthetic test, its throwing an error if there is Wait Step involved.

manojkunja avatar May 17 '24 01:05 manojkunja

Thanks for the report. We are looking into this.

skarimo avatar May 21 '24 19:05 skarimo

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

github-actions[bot] avatar Jun 21 '24 00:06 github-actions[bot]

Fixed by https://github.com/DataDog/datadog-api-client-python/pull/2009

jack-edmonds-dd avatar Jun 28 '24 15:06 jack-edmonds-dd