Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit a5f58ae

Browse files
authored
chore: fix test and add vscode workspace config (#3418)
- fix for randomly failing unit test after merging #3375 - add workspace config for vscode - increase coverage
1 parent 9d575b8 commit a5f58ae

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ secrets.auto.tfvars
1818
*.gz
1919
*.tgz
2020
*.env*
21-
.vscode
2221

2322
**/coverage/*
2423

Diff for: .vscode/gh-runners.code-workspace

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"folders": [
3+
{
4+
"name": "✨ root",
5+
"path": ".."
6+
},
7+
{
8+
"name": "🚀 @lambda/functions/control-plane",
9+
"path": "../lambdas/functions/control-plane"
10+
},
11+
{
12+
"name": "🚀 @lambda/functions/gh-agent-syncer",
13+
"path": "../lambdas/functions/gh-agent-syncer"
14+
},
15+
{
16+
"name": "🚀 @lambda/functions/webhook",
17+
"path": "../lambdas/functions/webhook"
18+
},
19+
{
20+
"name": "📦 @lambda/libs/aws-ssm-util",
21+
"path": "../lambdas/libs/aws-ssm-util"
22+
},
23+
{
24+
"name": "📦 @lambdas/libs/aws-powertools-util",
25+
"path": "../lambdas/libs/aws-powertools-util"
26+
}
27+
],
28+
"settings": {
29+
"jest.autoRun": "on",
30+
"jest.disabledWorkspaceFolders": [
31+
"✨ root"
32+
]
33+
}
34+
}

Diff for: lambdas/functions/control-plane/src/scale-runners/scale-down.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ let DEFAULT_ORG_RUNNERS_ORPHANED: RunnerInfo[];
8686
// i-running-111 | Repo | running and not exceeding minimumRunningTimeInMinutes
8787
// i-running-112 | Org | busy
8888
// i-running-113 | Repo | busy
89+
const oldest = moment(new Date()).subtract(25, 'minutes').toDate();
8990
const DEFAULT_RUNNERS_ORIGINAL = [
9091
{
9192
instanceId: 'i-idle-101',
@@ -105,17 +106,13 @@ const DEFAULT_RUNNERS_ORIGINAL = [
105106
},
106107
{
107108
instanceId: 'i-oldest-idle-103',
108-
launchTime: moment(new Date())
109-
.subtract(minimumRunningTimeInMinutes + 27, 'minutes')
110-
.toDate(),
109+
launchTime: oldest,
111110
type: 'Repo',
112111
owner: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
113112
},
114113
{
115114
instanceId: 'i-oldest-idle-104',
116-
launchTime: moment(new Date())
117-
.subtract(minimumRunningTimeInMinutes + 27, 'minutes')
118-
.toDate(),
115+
launchTime: oldest,
119116
type: 'Org',
120117
owner: TEST_DATA.repositoryOwner,
121118
},
@@ -229,6 +226,7 @@ describe('scaleDown', () => {
229226
process.env.ENVIRONMENT = environment;
230227
process.env.MINIMUM_RUNNING_TIME_IN_MINUTES = minimumRunningTimeInMinutes.toString();
231228
process.env.RUNNER_BOOT_TIME_IN_MINUTES = runnerBootTimeInMinutes.toString();
229+
232230
nock.disableNetConnect();
233231
jest.clearAllMocks();
234232
jest.resetModules();
@@ -398,6 +396,7 @@ describe('scaleDown', () => {
398396
idleCount: 3,
399397
cron: '* * * * * *',
400398
timeZone: 'Europe/Amsterdam',
399+
evictionStrategy: 'oldest_first',
401400
};
402401
beforeEach(() => {
403402
process.env.SCALE_DOWN_CONFIG = JSON.stringify([defaultConfig]);
@@ -542,6 +541,7 @@ describe('scaleDown', () => {
542541
idleCount: 3,
543542
cron: '* * * * * *',
544543
timeZone: 'Europe/Amsterdam',
544+
evictionStrategy: 'oldest_first',
545545
},
546546
]);
547547
});

0 commit comments

Comments
 (0)