Skip to content

Commit 5d59982

Browse files
committed
chore: log timestamps to help zero in on lenghty and/or flaky spots
1 parent 2d08997 commit 5d59982

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

packages/amplify-e2e-core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const createNewProjectDir = async (
122122
// Especially for nexpect output waiting
123123
// This makes it a perfect candidate for staggering test start times
124124
const initialDelay = Math.floor(Math.random() * 180 * 1000); // between 0 to 3 min
125-
console.log(`Waiting for ${initialDelay} ms`);
125+
console.log(`Waiting for ${initialDelay} ms (A)`);
126126
await sleep(initialDelay);
127127
}
128128

packages/amplify-e2e-tests/src/rds-v2-tests-common/rds-auth-oidc-fields.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ import { SQL_TESTS_USE_BETA } from './sql-e2e-config';
4747
// to deal with bug in cognito-identity-js
4848
(global as any).fetch = require('node-fetch');
4949

50+
function logTimestamp(message: string): void {
51+
const date = new Date();
52+
const timestamp = date.toISOString();
53+
console.log(`[${timestamp}] ${message}`);
54+
}
55+
5056
export const testOIDCFieldAuth = (engine: ImportedRDSType): void => {
5157
describe('SQL OIDC provider Field Auth tests', () => {
5258
const [db_user, db_password, db_identifier] = generator.generateMultiple(3);
@@ -76,9 +82,12 @@ export const testOIDCFieldAuth = (engine: ImportedRDSType): void => {
7682
const apiName = projName;
7783

7884
beforeAll(async () => {
85+
logTimestamp('beforeAll start');
7986
console.log(sqlCreateStatements(engine));
8087
projRoot = await createNewProjectDir(projName);
88+
logTimestamp('beforeAll before setupAmplifyProject');
8189
await setupAmplifyProject();
90+
logTimestamp('beforeAll end');
8291
});
8392

8493
afterAll(async () => {
@@ -111,21 +120,31 @@ export const testOIDCFieldAuth = (engine: ImportedRDSType): void => {
111120
};
112121

113122
const setupAmplifyProject = async (): Promise<void> => {
123+
logTimestamp('setupAmplifyProject start');
124+
125+
logTimestamp('setupAmplifyProject initJSProjectWithProfile');
114126
await initJSProjectWithProfile(projRoot, {
115127
disableAmplifyAppCreation: false,
116128
name: projName,
117129
});
118130

131+
logTimestamp('setupAmplifyProject getProjectMeta');
119132
const metaAfterInit = getProjectMeta(projRoot);
120133
region = metaAfterInit.providers.awscloudformation.Region;
121134

135+
logTimestamp('setupAmplifyProject addAuthWithPreTokenGenerationTrigger');
122136
await addAuthWithPreTokenGenerationTrigger(projRoot);
137+
138+
logTimestamp('setupAmplifyProject updatePreAuthTrigger');
123139
updatePreAuthTrigger(projRoot, 'user_id');
140+
141+
logTimestamp('setupAmplifyProject amplifyPush');
124142
await amplifyPush(projRoot, false, {
125143
useBetaSqlLayer: SQL_TESTS_USE_BETA,
126144
skipCodegen: true,
127145
});
128146

147+
logTimestamp('setupAmplifyProject addApi');
129148
await addApi(projRoot, {
130149
'OpenID Connect': {
131150
oidcProviderName: 'awscognitouserpool',
@@ -142,7 +161,10 @@ export const testOIDCFieldAuth = (engine: ImportedRDSType): void => {
142161
const ddbSchemaFilePath = path.join(projRoot, 'amplify', 'backend', 'api', apiName, 'schema.graphql');
143162
removeSync(ddbSchemaFilePath);
144163

164+
logTimestamp('setupAmplifyProject setupDatabase');
145165
await setupDatabase();
166+
167+
logTimestamp('setupAmplifyProject importRDSDatabase');
146168
await importRDSDatabase(projRoot, {
147169
database,
148170
engine,
@@ -156,24 +178,42 @@ export const testOIDCFieldAuth = (engine: ImportedRDSType): void => {
156178

157179
writeFileSync(rdsSchemaFilePath, appendAmplifyInput(schema, engine), 'utf8');
158180

181+
logTimestamp('setupAmplifyProject updateAuthAddUserGroups');
159182
await updateAuthAddUserGroups(projRoot, [adminGroupName, devGroupName]);
183+
184+
logTimestamp('setupAmplifyProject amplifyPush');
160185
await amplifyPush(projRoot, false, {
161186
useBetaSqlLayer: SQL_TESTS_USE_BETA,
162187
});
163188
await sleep(30 * 1000); // Wait for 30 seconds for the VPC endpoints to be live.
164189

190+
logTimestamp('setupAmplifyProject getUserPoolId');
165191
const userPoolId = getUserPoolId(projRoot);
192+
193+
logTimestamp('setupAmplifyProject configureAmplify');
166194
configureAmplify(projRoot);
195+
196+
logTimestamp('setupAmplifyProject setupUser(s)');
167197
await setupUser(userPoolId, userName1, userPassword, adminGroupName);
168198
await setupUser(userPoolId, userName2, userPassword, devGroupName);
199+
200+
logTimestamp('setupAmplifyProject getAppSyncEndpoint');
169201
graphQlEndpoint = getAppSyncEndpoint(projRoot, apiName);
202+
203+
logTimestamp('setupAmplifyProject signInUser(s)');
170204
const user1 = await signInUser(userName1, userPassword);
171205
userMap[userName1] = user1;
172206
const user2 = await signInUser(userName2, userPassword);
173207
userMap[userName2] = user2;
208+
209+
logTimestamp('setupAmplifyProject configureAppSyncClients');
174210
const appSyncClients = await configureAppSyncClients(projRoot, apiName, [oidcProvider, apiKeyProvider], userMap);
211+
212+
logTimestamp('setupAmplifyProject createModelOperationHelpers(s)');
175213
user1ModelOperationHelpers = createModelOperationHelpers(appSyncClients[oidcProvider][userName1], schema);
176214
user2ModelOperationHelpers = createModelOperationHelpers(appSyncClients[oidcProvider][userName2], schema);
215+
216+
logTimestamp('setupAmplifyProject end');
177217
};
178218

179219
test('Private model auth and allowed field operations', async () => {

packages/amplify-graphql-model-transformer/rds-patching-lambda/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const delay = (ms: number): Promise<void> => new Promise((resolve) => setTimeout
1414

1515
const waitRandomTime = (): Promise<void> => {
1616
const waitTime = Math.floor(Math.random() * (MAX_WAIT_TIME_IN_MS - MIN_WAIT_TIME_IN_MS + 1) + MIN_WAIT_TIME_IN_MS);
17-
console.log(`Waiting for ${waitTime} ms`);
17+
console.log(`Waiting for ${waitTime} ms (B)`);
1818
return delay(waitTime);
1919
};
2020

0 commit comments

Comments
 (0)