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(cli-lib): set skipLibCheck on generateSchema to prevent intermittent test failures #26551

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Jul 28, 2023

Attempts to resolve intermittent failures in the cloud-assembly-schema test case.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team July 28, 2023 13:54
@github-actions github-actions bot added the p2 label Jul 28, 2023
@mrgrain
Copy link
Contributor Author

mrgrain commented Jul 28, 2023

These are the failures:

aws-cdk-lib: FAIL cloud-assembly-schema/test/schema.test.js (10.329 s)
aws-cdk-lib:   â—� if this test fails, run "yarn update-schema"
aws-cdk-lib:     TypeError: Cannot read properties of null (reading 'definitions')
aws-cdk-lib:     �[0m �[90m 126 |�[39m �[90m */�[39m�[0m
aws-cdk-lib:     �[0m �[90m 127 |�[39m �[36mfunction�[39m addAnyMetadataEntry(schema�[33m:�[39m any) {�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 128 |�[39m   schema�[33m.�[39mdefinitions�[33m.�[39m�[33mMetadataEntry�[39m�[33m?�[39m�[33m.�[39mproperties�[33m.�[39mdata�[33m.�[39manyOf�[33m.�[39mpush({ description�[33m:�[39m �[32m'Free form data.'�[39m })�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m     |�[39m          �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 129 |�[39m }�[0m
aws-cdk-lib:     �[0m �[90m 130 |�[39m�[0m
aws-cdk-lib:       at definitions (cloud-assembly-schema/scripts/update-schema.ts:128:10)
aws-cdk-lib:       at addAnyMetadataEntry (cloud-assembly-schema/scripts/update-schema.ts:72:3)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib: FAIL cloud-assembly-schema/test/schema.test.js (10.329 s)
aws-cdk-lib:   â—� Console
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (1,21): Cannot find module 'fs' or its corresponding type declarations.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (16,23): Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (18,25): Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (23,24): Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (25,22): Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (274,31): Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2017' or later.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:     console.error
aws-cdk-lib:       /codebuild/output/src4063030624/src/github.com/aws/aws-cdk/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts (282,31): Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2017' or later.
aws-cdk-lib:     �[0m �[90m 67 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 68 |�[39m   �[36mconst�[39m program �[33m=�[39m tjs�[33m.�[39mgetProgramFromFiles([path�[33m.�[39mjoin(__dirname�[33m,�[39m �[32m'../lib/index.d.ts'�[39m)]�[33m,�[39m compilerOptions)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 69 |�[39m   �[36mconst�[39m schema �[33m=�[39m tjs�[33m.�[39mgenerateSchema(program�[33m,�[39m spec�[33m.�[39mrootTypeName�[33m,�[39m settings)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m    |�[39m                      �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 70 |�[39m�[0m
aws-cdk-lib:     �[0m �[90m 71 |�[39m   augmentDescription(schema)�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m 72 |�[39m   addAnyMetadataEntry(schema)�[33m;�[39m�[0m
aws-cdk-lib:       at ../../node_modules/typescript-json-schema/typescript-json-schema.ts:1704:17
aws-cdk-lib:           at Array.forEach (<anonymous>)
aws-cdk-lib:       at buildGenerator (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1698:6)
aws-cdk-lib:       at Object.generateSchema (../../node_modules/typescript-json-schema/typescript-json-schema.ts:1726:67)
aws-cdk-lib:       at generateSchema (cloud-assembly-schema/scripts/update-schema.ts:69:22)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)
aws-cdk-lib:   â—� if this test fails, run "yarn update-schema"
aws-cdk-lib:     TypeError: Cannot read properties of null (reading 'definitions')
aws-cdk-lib:     �[0m �[90m 126 |�[39m �[90m */�[39m�[0m
aws-cdk-lib:     �[0m �[90m 127 |�[39m �[36mfunction�[39m addAnyMetadataEntry(schema�[33m:�[39m any) {�[0m
aws-cdk-lib:     �[0m�[31m�[1m>�[22m�[39m�[90m 128 |�[39m   schema�[33m.�[39mdefinitions�[33m.�[39m�[33mMetadataEntry�[39m�[33m?�[39m�[33m.�[39mproperties�[33m.�[39mdata�[33m.�[39manyOf�[33m.�[39mpush({ description�[33m:�[39m �[32m'Free form data.'�[39m })�[33m;�[39m�[0m
aws-cdk-lib:     �[0m �[90m     |�[39m          �[31m�[1m^�[22m�[39m�[0m
aws-cdk-lib:     �[0m �[90m 129 |�[39m }�[0m
aws-cdk-lib:     �[0m �[90m 130 |�[39m�[0m
aws-cdk-lib:       at definitions (cloud-assembly-schema/scripts/update-schema.ts:128:10)
aws-cdk-lib:       at addAnyMetadataEntry (cloud-assembly-schema/scripts/update-schema.ts:72:3)
aws-cdk-lib:       at Object.<anonymous> (cloud-assembly-schema/test/schema.test.ts:12:53)

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 28, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@mrgrain mrgrain added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Jul 28, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 28, 2023 13:57

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mrgrain mrgrain self-assigned this Jul 28, 2023
@mrgrain mrgrain marked this pull request as ready for review July 28, 2023 16:43
@mergify
Copy link
Contributor

mergify bot commented Jul 28, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: a8e559b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 1807f57 into main Jul 28, 2023
8 checks passed
@mergify mergify bot deleted the mrgrain/chore/fix-flaky-cloud-assembly-test branch July 28, 2023 18:47
@mergify
Copy link
Contributor

mergify bot commented Jul 28, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify bot pushed a commit that referenced this pull request Jul 30, 2023
…e not free of side-effects (#26568)

The attempted fix in #26551 did not work.

This is another attempt with a different approach.
Based on the fact that the failure occurs in `manifest.ts`, there appear to be circumstances for this file to be load in a context that is not fully initialized. Thus the `Cannot find name 'require'` error.
However runtime code like `require` is not needed to generate the schemas.
In fact the `manifest.ts` file isn't needed at all for this.

This change ensures that only the required files are loaded when generating each schema.
Hopefully this will bypass the erroneous code.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants