From 7cb97a2ef0a765862d21842693967070b0dcdd49 Mon Sep 17 00:00:00 2001 From: Nikolas Komonen <118216176+nkomonen-amazon@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:59:47 -0400 Subject: [PATCH] fix(ci): e2e test updateDevEnv failing #3357 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 --- src/testE2E/codecatalyst/client.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/testE2E/codecatalyst/client.test.ts b/src/testE2E/codecatalyst/client.test.ts index a03c3db5857..f15c0176fa3 100644 --- a/src/testE2E/codecatalyst/client.test.ts +++ b/src/testE2E/codecatalyst/client.test.ts @@ -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) @@ -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) @@ -334,6 +341,7 @@ describe('Test how this codebase uses the CodeCatalyst API', function () { instanceType, persistentStorage, alias: createAlias(), + inactivityTimeoutMinutes: 15, } }