Skip to content

Commit

Permalink
fix lint and e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Jul 16, 2024
1 parent 2d11214 commit 3c846fb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
2 changes: 2 additions & 0 deletions packages/backend-function/src/factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ void describe('AmplifyFunctionFactory', () => {
Targets: [
{
Arn: {
// eslint-disable-next-line spellcheck/spell-checker
'Fn::GetAtt': ['handlerlambdaE29D1580', 'Arn'],
},
Id: 'Target0',
Expand All @@ -367,6 +368,7 @@ void describe('AmplifyFunctionFactory', () => {
Targets: [
{
Arn: {
// eslint-disable-next-line spellcheck/spell-checker
'Fn::GetAtt': ['handlerlambdaE29D1580', 'Arn'],
},
Id: 'Target0',
Expand Down
5 changes: 0 additions & 5 deletions packages/integration-tests/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@
* Used to run `create amplify` at a specific tagged release
*/
export const amplifyAtTag = 'amplify@latest';

/**
* Used as environment key for function to increment to keep track of number of invocations
*/
export const numInvocationsKey = 'NUM_INVOCATIONS';
13 changes: 7 additions & 6 deletions packages/integration-tests/src/test-e2e/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
amplifySharedSecretNameKey,
createAmplifySharedSecretName,
} from '../shared_secret.js';
import { numInvocationsKey } from '../constants.js';

const testProjectCreators = getTestProjectCreators();
const testCdkProjectCreators = getTestCdkProjectCreators();
Expand Down Expand Up @@ -131,12 +130,14 @@ void describe('deployment tests', { concurrency: testConcurrencyLevel }, () => {
});

void describe('in sequence', { concurrency: false }, () => {
const env = {
const sharedSecretsEnv = {
[amplifySharedSecretNameKey]: createAmplifySharedSecretName(),
[numInvocationsKey]: '0',
};
void it(`[${testProjectCreator.name}] deploys fully`, async () => {
await testProject.deploy(sandboxBackendIdentifier, env);
await testProject.deploy(
sandboxBackendIdentifier,
sharedSecretsEnv
);
await testProject.assertPostDeployment(sandboxBackendIdentifier);
});

Expand All @@ -145,7 +146,7 @@ void describe('deployment tests', { concurrency: testConcurrencyLevel }, () => {
['sandbox', '--once'],
testProject.projectDirPath,
{
env,
env: sharedSecretsEnv,
}
);
await processController
Expand All @@ -160,7 +161,7 @@ void describe('deployment tests', { concurrency: testConcurrencyLevel }, () => {
['sandbox', '--dirToWatch', 'amplify'],
testProject.projectDirPath,
{
env,
env: sharedSecretsEnv,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { HeadBucketCommand, S3Client } from '@aws-sdk/client-s3';
import { GetRoleCommand, IAMClient } from '@aws-sdk/client-iam';
import { AmplifyClient } from '@aws-sdk/client-amplify';
import { numInvocationsKey } from '../constants.js';

/**
* Creates test projects with data, storage, and auth categories.
Expand Down Expand Up @@ -141,12 +140,11 @@ class DataStorageAuthWithTriggerTestProject extends TestProjectBase {
amplifySharedSecretNameKey in environment
? environment[amplifySharedSecretNameKey]
: createAmplifySharedSecretName();
const env = {
const sharedSecretsEnv = {
[amplifySharedSecretNameKey]: this.amplifySharedSecret,
[numInvocationsKey]: '0',
};
await this.setUpDeployEnvironment(backendIdentifier);
await super.deploy(backendIdentifier, env);
await super.deploy(backendIdentifier, sharedSecretsEnv);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/**
* This function asserts that schedule functions are working properly
*/
let numInvocations = 0;
export const handler = async () => {
let numInvocations = process.env.NUM_INVOCATIONS
? Number(process.env.NUM_INVOCATIONS)
: 100;
numInvocations++;
process.env.NUM_INVOCATIONS = numInvocations.toString();

return numInvocations;
};

0 comments on commit 3c846fb

Please sign in to comment.