opensearch-py icon indicating copy to clipboard operation
opensearch-py copied to clipboard

[FEATURE] Generated tests for generated code

Open VachaShah opened this issue 1 year ago • 6 comments

Coming from https://github.com/opensearch-project/opensearch-py/pull/511#pullrequestreview-1655403319, as @dblock suggested, we should have tests for all the generated code we are putting in, starting with some basic tests that are also generated.

VachaShah avatar Oct 03 '23 19:10 VachaShah

I recommend using this Yaml test runner for integration tests. https://github.com/opensearch-project/opensearch-py/blob/main/test_opensearchpy/test_server/test_rest_api_spec.py

saimedhi avatar Oct 03 '23 19:10 saimedhi

@saimedhi Can we generate some tests from this?

VachaShah avatar Oct 03 '23 19:10 VachaShah

The YAML test runner generates tests based on the spec https://github.com/saimedhi/OpenSearch/tree/main/rest-api-spec/src/main/resources/rest-api-spec/test These tests are stored temporarily and won't be saved. While I'm not certain if these tests can be displayed in clients, they are running and can be utilized.

saimedhi avatar Oct 03 '23 19:10 saimedhi

I think some unit tests wouldn't hurt either.

dblock avatar Oct 04 '23 16:10 dblock

@saimedhi Are we generating with the recent changes when a new API is added? If we do we can close this.

dblock avatar Nov 10 '23 14:11 dblock

Currently tests are not generated. This needs to be done :)

saimedhi avatar Nov 10 '23 18:11 saimedhi