Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coverage #63

Merged
merged 10 commits into from
Aug 15, 2023
Merged

Fix coverage #63

merged 10 commits into from
Aug 15, 2023

Conversation

teowa
Copy link
Contributor

@teowa teowa commented Aug 3, 2023

  • prevent the program from crashing if there is an error generating the coverage report.
  • add a test that uses local swagger test data to verify that the code is working correctly.
  • add a test that expands all PUT and POST models twice and compares the results to each other. This will help to ensure that the expand function is stable and that it is producing consistent results
  • fix the discriminator resolve function to support cases where only the child variant is used, and cases where the x-ms-discriminator-value extension is not used
  • This task will download the index.zip instead of index.json file and reduce its file size from 50MB to 2MB.

@@ -147,6 +147,12 @@ func NewPassReport(plan *tfjson.Plan) types.PassReport {
}

func NewCoverageReportFromState(state *tfjson.State) (coverage.CoverageReport, error) {
defer func() {
if r := recover(); r != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to fix the panic instead of calling the cover()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to prevent the main process (which validates and generates the pass report) from crashing if the coverage report fails to generate. The coverage report might fail to generate due to the following reasons:

  • The index file cannot be downloaded.
  • The online swagger file cannot be downloaded.
  • The swagger ref or variant cannot be correctly processed.

@ms-henglu ms-henglu merged commit 23f8092 into Azure:main Aug 15, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants