Skip to content

Commit

Permalink
add deploy test
Browse files Browse the repository at this point in the history
  • Loading branch information
0618 committed Jan 10, 2024
1 parent 5ef40d1 commit 93689a0
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions packages/integration-tests/src/e2e-flow/e2e_flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {
DeleteStackCommand,
} from '@aws-sdk/client-cloudformation';
import { BackendIdentifierConversions } from '@aws-amplify/platform-core';
import {
ClientConfigFormat,
getClientConfigPath,
} from '@aws-amplify/client-config';
import { amplifyCli } from '../process-controller/process_controller.js';
import { TestBranch, amplifyAppPool } from '../amplify_app_pool.js';
import { testConcurrencyLevel } from '../test-e2e/test_concurrency.js';
Expand Down Expand Up @@ -338,6 +342,60 @@ void describe('amplify', { concurrency: concurrency }, () => {
}
);

const cfnClient = new CloudFormationClient(e2eToolingClientConfig);
const testBranch = await amplifyAppPool.createTestBranch();
const branchBackendIdentifier: BackendIdentifier = {
namespace: testBranch.appId,
name: testBranch.branchName,
type: 'branch',
};

await amplifyCli(
[
'pipeline-deploy',
'--branch',
branchBackendIdentifier.name,
'--appId',
branchBackendIdentifier.namespace,
],
tempDir,
{
env: { CI: 'true' },
}
).run();

const clientConfigStats = await fsp.stat(
await getClientConfigPath(tempDir)
);

assert.ok(clientConfigStats.isFile());

const testBranchDetails = await amplifyAppPool.fetchTestBranchDetails(
testBranch
);
assert.ok(
testBranchDetails.backend?.stackArn,
'branch should have stack associated'
);
assert.ok(
testBranchDetails.backend?.stackArn?.includes(
branchBackendIdentifier.namespace
)
);
assert.ok(
testBranchDetails.backend?.stackArn?.includes(
branchBackendIdentifier.name
)
);

await cfnClient.send(
new DeleteStackCommand({
StackName: BackendIdentifierConversions.toStackName(
branchBackendIdentifier
),
})
);

// if (index === 1) {
// void describe('amplify deploys', async () => {
// void describe(`branch deploys project`, () => {
Expand Down

0 comments on commit 93689a0

Please sign in to comment.