Skip to content

Commit

Permalink
chore: fix test and add vscode workspace config (#3418)
Browse files Browse the repository at this point in the history
- fix for randomly failing unit test after merging #3375
- add workspace config for vscode
- increase coverage
  • Loading branch information
npalm authored Aug 9, 2023
1 parent 9d575b8 commit a5f58ae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ secrets.auto.tfvars
*.gz
*.tgz
*.env*
.vscode

**/coverage/*

Expand Down
34 changes: 34 additions & 0 deletions .vscode/gh-runners.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"folders": [
{
"name": "✨ root",
"path": ".."
},
{
"name": "🚀 @lambda/functions/control-plane",
"path": "../lambdas/functions/control-plane"
},
{
"name": "🚀 @lambda/functions/gh-agent-syncer",
"path": "../lambdas/functions/gh-agent-syncer"
},
{
"name": "🚀 @lambda/functions/webhook",
"path": "../lambdas/functions/webhook"
},
{
"name": "📦 @lambda/libs/aws-ssm-util",
"path": "../lambdas/libs/aws-ssm-util"
},
{
"name": "📦 @lambdas/libs/aws-powertools-util",
"path": "../lambdas/libs/aws-powertools-util"
}
],
"settings": {
"jest.autoRun": "on",
"jest.disabledWorkspaceFolders": [
"✨ root"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ let DEFAULT_ORG_RUNNERS_ORPHANED: RunnerInfo[];
// i-running-111 | Repo | running and not exceeding minimumRunningTimeInMinutes
// i-running-112 | Org | busy
// i-running-113 | Repo | busy
const oldest = moment(new Date()).subtract(25, 'minutes').toDate();
const DEFAULT_RUNNERS_ORIGINAL = [
{
instanceId: 'i-idle-101',
Expand All @@ -105,17 +106,13 @@ const DEFAULT_RUNNERS_ORIGINAL = [
},
{
instanceId: 'i-oldest-idle-103',
launchTime: moment(new Date())
.subtract(minimumRunningTimeInMinutes + 27, 'minutes')
.toDate(),
launchTime: oldest,
type: 'Repo',
owner: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
},
{
instanceId: 'i-oldest-idle-104',
launchTime: moment(new Date())
.subtract(minimumRunningTimeInMinutes + 27, 'minutes')
.toDate(),
launchTime: oldest,
type: 'Org',
owner: TEST_DATA.repositoryOwner,
},
Expand Down Expand Up @@ -229,6 +226,7 @@ describe('scaleDown', () => {
process.env.ENVIRONMENT = environment;
process.env.MINIMUM_RUNNING_TIME_IN_MINUTES = minimumRunningTimeInMinutes.toString();
process.env.RUNNER_BOOT_TIME_IN_MINUTES = runnerBootTimeInMinutes.toString();

nock.disableNetConnect();
jest.clearAllMocks();
jest.resetModules();
Expand Down Expand Up @@ -398,6 +396,7 @@ describe('scaleDown', () => {
idleCount: 3,
cron: '* * * * * *',
timeZone: 'Europe/Amsterdam',
evictionStrategy: 'oldest_first',
};
beforeEach(() => {
process.env.SCALE_DOWN_CONFIG = JSON.stringify([defaultConfig]);
Expand Down Expand Up @@ -542,6 +541,7 @@ describe('scaleDown', () => {
idleCount: 3,
cron: '* * * * * *',
timeZone: 'Europe/Amsterdam',
evictionStrategy: 'oldest_first',
},
]);
});
Expand Down

0 comments on commit a5f58ae

Please sign in to comment.