Skip to content

Commit

Permalink
fix(amplify-category-api): fix db name generation in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sundersc committed Aug 10, 2024
1 parent f19283b commit f4dc095
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/amplify-e2e-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"semver": "^7.5.2",
"strip-ansi": "^6.0.0",
"throat": "^5.0.0",
"uuid": "^8.3.2"
"uuid": "^8.3.2",
"random-words": "2.0.1"
},
"devDependencies": {
"@types/ini": "^1.3.31"
Expand Down
5 changes: 3 additions & 2 deletions packages/amplify-e2e-core/src/utils/rds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { KMSClient, CreateKeyCommand, ScheduleKeyDeletionCommand } from '@aws-sd
import { knex } from 'knex';
import axios from 'axios';
import { sleep } from './sleep';
import { generate as generateWord } from 'random-words';

const DEFAULT_DB_INSTANCE_TYPE = 'db.m5.large';
const DEFAULT_DB_STORAGE = 8;
Expand Down Expand Up @@ -427,11 +428,11 @@ export const deleteDBCluster = async (identifier: string, region: string): Promi
}
};

const createInstanceIdentifier = (prefix: string) => {
const createInstanceIdentifier = (prefix: string): string => {
return `${prefix}instance`;
};

export const generateDBName = () => generator.generate({ length: 8 }).toLowerCase();
export const generateDBName = (): string => (generateWord() as string).toLowerCase();

/**
* Adds the given inbound rule to the security group.
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19188,6 +19188,13 @@ quick-lru@^5.1.1:
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==

[email protected]:
version "2.0.1"
resolved "https://registry.yarnpkg.com/random-words/-/random-words-2.0.1.tgz#cc4564385d040c9fad2b817621a0041a1ecc90f6"
integrity sha512-nZNJAmgcFmtJMTDDIUCm/iK4R6RydC6NvALvWhYItXQrgYGk1F7Gww416LpVROFQtfVd5TaLEf4WuSsko03N7w==
dependencies:
seedrandom "^3.0.5"

randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
Expand Down Expand Up @@ -19828,6 +19835,11 @@ schema-utils@^4.0.0:
ajv-formats "^2.1.1"
ajv-keywords "^5.1.0"

seedrandom@^3.0.5:
version "3.0.5"
resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7"
integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==

semver-compare@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
Expand Down

0 comments on commit f4dc095

Please sign in to comment.