Skip to content

Commit

Permalink
fix(ci): e2e test updateDevEnv failing #3357
Browse files Browse the repository at this point in the history
For some reason the cc backend did not receive at
dev env id from our e2e test updateDevEnv api call.

This commit verifies we are giving a dev env id
before sending the api request.

Additional:

We used the variable 'global' before it could
be properly initialized and due to the order of
execution this variable was accessed before it
could be properly initialized.

To fix this it was moved inside a 'before' block
which will ensure it gets executed AFTER all the
pre-test hooks are fun, which includes initializing
the global variable

Signed-off-by: Nikolas Komonen <[email protected]>
  • Loading branch information
nkomonen-amazon authored Apr 21, 2023
1 parent f243990 commit 7cb97a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/testE2E/codecatalyst/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ describe('Test how this codebase uses the CodeCatalyst API', function () {
})

describe('getThisDevEnv', function () {
const ccAuth = CodeCatalystAuthenticationProvider.fromContext(globals.context)
let ccAuth: CodeCatalystAuthenticationProvider

before(function () {
ccAuth = CodeCatalystAuthenticationProvider.fromContext(globals.context)
})

it('returns `undefined` if not in a dev environment', async function () {
const result = await getThisDevEnv(ccAuth)
Expand Down Expand Up @@ -260,6 +264,9 @@ describe('Test how this codebase uses the CodeCatalyst API', function () {
assert.notStrictEqual(defaultDevEnv.alias, newDevEnvSettings.alias)
assert.notStrictEqual(defaultDevEnv.instanceType, newDevEnvSettings.instanceType)

// Sanity Check due to: https://issues.amazon.com/Velox-Bug-42
assert.ok(defaultDevEnv.id, 'Dev Env ID should not be empty.')

// Update dev env
const updatedDevEnv = await commands.updateDevEnv(defaultDevEnv, newDevEnvSettings)

Expand Down Expand Up @@ -334,6 +341,7 @@ describe('Test how this codebase uses the CodeCatalyst API', function () {
instanceType,
persistentStorage,
alias: createAlias(),
inactivityTimeoutMinutes: 15,
}
}

Expand Down

0 comments on commit 7cb97a2

Please sign in to comment.