Skip to content

Fix E2E tests, simplify GetAtt logic for revert, clean up README file contents#14189

Merged
abhi7cr merged 4 commits intomigrationsfrom
gen2-migrations-execute
Apr 23, 2025
Merged

Fix E2E tests, simplify GetAtt logic for revert, clean up README file contents#14189
abhi7cr merged 4 commits intomigrationsfrom
gen2-migrations-execute

Conversation

@abhi7cr
Copy link
Copy Markdown
Contributor

@abhi7cr abhi7cr commented Apr 23, 2025

Description of changes

  • Fix E2E tests
  • Remove redundant GetAtt logic for revert in template generator. We have moved GetAtt logic to cfn-output-resolver.ts. This was causing revert to fail for auth category.
  • Clean up README file contents
    • Use OAuth flag to conditionally render domain removal statement
    • Remove npx sandbox instruction as we want customers to use CI/CD for refactor.

Description of how you validated changes

unit tests, E2E tests, manual testing of commands

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

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

@abhi7cr abhi7cr requested review from a team as code owners April 23, 2025 17:29
Comment thread packages/amplify-migration-template-gen/src/template-generator.ts Fixed
const gen2Region = gen2Meta.auth.aws_region;
const gen2Resource = await getResourceDetails('AWS::Cognito::UserPool', gen2UserPoolId, gen2Region);
console.log(gen1Resource, gen2Resource);
gen1Resource.UserPoolName = extractUserPoolNamePrefix(gen1Resource.UserPoolName);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sandbox environment will have different user pool names compared to the gen1 environment name

const gen1ClientIdWeb = gen1ClientIds[0];
const gen1ResourceIds = [gen1UserPoolId, gen1IdentityPoolId, gen1ClientIdWeb];

const gen1ResourceDetails = await Promise.all([
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removing CloudControl API checks since we are querying for the same resource.

// Assert
await assertExecuteCommand(projRoot, CATEGORIES_TO_MOVE);

runRevertCommand(projRoot, gen1StackName, gen2StackName);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: add assertion post revert once the GetAtt removal changes are released in the next tagged release.

await assertDefaultGen1Setup(projRoot);
runCodegenCommand(projRoot);
copyFunctionFile(projRoot, 'function', gen1FunctionName);
copyGen1Schema(projRoot, projName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This was needed to be done manually at the time when tests were written. Discussed offline with @abhi7cr , this is been handled as part of the codegen now.

socialProvider = 'APPLE_PRIVATE_KEY_2';
}
process.env[socialProvider] = process.env[socialProvider] ?? value;
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe initially when I wrote this test, I did not consider this case if the variables are not defined locally. It is good to have this here for both cases, tests run locally or in the CI/CD flow in CodeBuild.

@abhi7cr abhi7cr merged commit 19ba7cf into migrations Apr 23, 2025
5 checks passed
@abhi7cr abhi7cr deleted the gen2-migrations-execute branch April 23, 2025 23:41
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