Skip to content

Commit 5befc2f

Browse files
authored
Merge pull request #247 from DataDog/bump-datadog-ci/2.35.0
[dep] Bump datadog-ci to `2.35.0`
2 parents 3178819 + 7957306 commit 5befc2f

File tree

8 files changed

+50
-42
lines changed

8 files changed

+50
-42
lines changed

.github/workflows/e2e/global.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"global": {
2+
"defaultTestOverrides": {
33
"headers": {
44
"X-Fake-Header": "fake value"
55
},

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ jobs:
9393
variables: 'START_URL=https://staging.website.com,PASSWORD=stagingpassword'
9494
```
9595

96-
### Example workflow using a global configuration override with `config_path`
96+
### Example workflow using a global configuration file with `config_path`
9797

98-
This GitHub Action overrides the path to the global `datadog-ci.config.json` file.
98+
By default, the path to the global configuration file is `datadog-ci.json`. You can override this path with the `config_path` input.
9999

100100
```yaml
101101
name: Run Synthetic tests with custom config
@@ -110,10 +110,10 @@ jobs:
110110
with:
111111
api_key: ${{secrets.DD_API_KEY}}
112112
app_key: ${{secrets.DD_APP_KEY}}
113-
config_path: './synthetics-config.json'
113+
config_path: './global.config.json'
114114
```
115115

116-
For an example test file, see this [`global.config.json` file][13].
116+
For an example of global configuration file, see this [`global.config.json` file][13].
117117

118118
## Inputs
119119

__tests__/main.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Run Github Action', () => {
5353
expect(synthetics.executeTests).toHaveBeenCalledWith(expect.anything(), {
5454
...config,
5555
...inputs,
56-
global: {
57-
...config.global,
56+
defaultTestOverrides: {
57+
...config.defaultTestOverrides,
5858
pollingTimeout: config.pollingTimeout,
5959
},
6060
})
@@ -72,8 +72,8 @@ describe('Run Github Action', () => {
7272
expect(synthetics.executeTests).toHaveBeenCalledWith(expect.anything(), {
7373
...config,
7474
...inputs,
75-
global: {
76-
...config.global,
75+
defaultTestOverrides: {
76+
...config.defaultTestOverrides,
7777
pollingTimeout: config.pollingTimeout,
7878
},
7979
publicIds,
@@ -92,8 +92,8 @@ describe('Run Github Action', () => {
9292
expect(synthetics.executeTests).toHaveBeenCalledWith(expect.anything(), {
9393
...config,
9494
...inputs,
95-
global: {
96-
...config.global,
95+
defaultTestOverrides: {
96+
...config.defaultTestOverrides,
9797
pollingTimeout: config.pollingTimeout,
9898
variables: {
9999
START_URL: 'https://example.org',
@@ -120,8 +120,8 @@ describe('Run Github Action', () => {
120120
expect(synthetics.executeTests).toHaveBeenCalledWith(expect.anything(), {
121121
...config,
122122
...inputs,
123-
global: {
124-
...config.global,
123+
defaultTestOverrides: {
124+
...config.defaultTestOverrides,
125125
pollingTimeout: config.pollingTimeout,
126126
},
127127
})
@@ -144,8 +144,8 @@ describe('Run Github Action', () => {
144144
...config,
145145
...inputs,
146146
datadogSite: 'datadoghq.com',
147-
global: {
148-
...config.global,
147+
defaultTestOverrides: {
148+
...config.defaultTestOverrides,
149149
pollingTimeout: config.pollingTimeout,
150150
},
151151
})

__tests__/resolve-config.test.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,29 @@ describe('Resolves Config', () => {
4545
) => {
4646
callback(null, Buffer.from(JSON.stringify({files: ['foobar.synthetics.json']})))
4747
}) as typeof fs.readFile
48+
4849
jest.spyOn(fs, 'existsSync').mockImplementation(() => true)
4950
jest.spyOn(fs, 'readFile').mockImplementation(fakeReadFile)
51+
5052
await expect(resolveConfig.resolveConfig(mockReporter)).resolves.toStrictEqual({
5153
...config,
5254
...requiredInputs,
5355
files: ['foobar.synthetics.json'],
54-
global: {
55-
...config.global,
56+
defaultTestOverrides: {
57+
...config.defaultTestOverrides,
5658
pollingTimeout: config.pollingTimeout,
5759
},
5860
})
5961
})
6062

61-
test('Default configuration applied if global configuration empty', async () => {
63+
test('Default configuration applied if global configuration is empty', async () => {
6264
jest.spyOn(fs, 'existsSync').mockImplementation(() => false)
65+
6366
await expect(resolveConfig.resolveConfig(mockReporter)).resolves.toStrictEqual({
6467
...config,
6568
...requiredInputs,
66-
global: {
67-
...config.global,
69+
defaultTestOverrides: {
70+
...config.defaultTestOverrides,
6871
pollingTimeout: config.pollingTimeout,
6972
},
7073
})
@@ -79,8 +82,8 @@ describe('Resolves Config', () => {
7982
await expect(resolveConfig.resolveConfig(mockReporter)).resolves.toStrictEqual({
8083
...config,
8184
...requiredInputs,
82-
global: {
83-
...config.global,
85+
defaultTestOverrides: {
86+
...config.defaultTestOverrides,
8487
pollingTimeout: config.pollingTimeout,
8588
variables: {START_URL: 'https://example.org', MY_VARIABLE: 'My title'},
8689
},
@@ -91,8 +94,8 @@ describe('Resolves Config', () => {
9194
await expect(resolveConfig.resolveConfig(mockReporter)).resolves.toStrictEqual({
9295
...config,
9396
...requiredInputs,
94-
global: {
95-
...config.global,
97+
defaultTestOverrides: {
98+
...config.defaultTestOverrides,
9699
pollingTimeout: config.pollingTimeout,
97100
},
98101
})
@@ -130,7 +133,9 @@ describe('Resolves Config', () => {
130133
describe('parses integer', () => {
131134
test('falls back to default if input is not set', async () => {
132135
expect(resolveConfig.getDefinedInteger('polling_timeout')).toBeUndefined()
133-
expect((await resolveConfig.resolveConfig(mockReporter)).global.pollingTimeout).toStrictEqual(30 * 60 * 1000)
136+
expect((await resolveConfig.resolveConfig(mockReporter)).defaultTestOverrides?.pollingTimeout).toStrictEqual(
137+
30 * 60 * 1000
138+
)
134139
})
135140

136141
test('falls back to default if input is an empty value', async () => {
@@ -139,7 +144,9 @@ describe('Resolves Config', () => {
139144
INPUT_POLLING_TIMEOUT: '',
140145
}
141146
expect(resolveConfig.getDefinedInteger('polling_timeout')).toBeUndefined()
142-
expect((await resolveConfig.resolveConfig(mockReporter)).global.pollingTimeout).toStrictEqual(30 * 60 * 1000)
147+
expect((await resolveConfig.resolveConfig(mockReporter)).defaultTestOverrides?.pollingTimeout).toStrictEqual(
148+
30 * 60 * 1000
149+
)
143150
})
144151

145152
test('throws if input is a float', async () => {
@@ -155,7 +162,7 @@ describe('Resolves Config', () => {
155162
...process.env,
156163
INPUT_POLLING_TIMEOUT: '1',
157164
}
158-
expect((await resolveConfig.resolveConfig(mockReporter)).global.pollingTimeout).toStrictEqual(1)
165+
expect((await resolveConfig.resolveConfig(mockReporter)).defaultTestOverrides?.pollingTimeout).toStrictEqual(1)
159166
})
160167
})
161168
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"packageManager": "yarn@3.4.1",
3434
"dependencies": {
3535
"@actions/core": "^1.9.1",
36-
"@datadog/datadog-ci": "^2.33.0",
36+
"@datadog/datadog-ci": "^2.35.0",
3737
"deep-extend": "0.6.0"
3838
},
3939
"devDependencies": {

src/fixtures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const config: synthetics.RunTestsCommandConfig = {
55
appKey: '',
66
configPath: 'datadog-ci.json',
77
datadogSite: 'datadoghq.com',
8+
defaultTestOverrides: {},
89
failOnCriticalErrors: false,
910
failOnMissingTests: false,
1011
failOnTimeout: true,

src/resolve-config.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ export const resolveConfig = async (reporter: synthetics.MainReporter): Promise<
5454
appKey,
5555
configPath,
5656
datadogSite,
57+
defaultTestOverrides: deepExtend(
58+
config.defaultTestOverrides,
59+
utils.removeUndefinedValues({
60+
pollingTimeout,
61+
variables: synthetics.utils.parseVariablesFromCli(variableStrings, reporter.log.bind(reporter)),
62+
})
63+
),
5764
failOnCriticalErrors,
5865
failOnMissingTests,
5966
failOnTimeout,
@@ -63,18 +70,11 @@ export const resolveConfig = async (reporter: synthetics.MainReporter): Promise<
6370
subdomain,
6471
testSearchQuery,
6572
tunnel,
66-
global: deepExtend(
67-
config.global,
68-
utils.removeUndefinedValues({
69-
pollingTimeout,
70-
variables: synthetics.utils.parseVariablesFromCli(variableStrings, reporter.log.bind(reporter)),
71-
})
72-
),
7373
})
7474
)
7575

76-
// Pass root polling timeout to global override to get it applied to all tests if not defined individually
77-
config.global.pollingTimeout = config.global.pollingTimeout ?? config.pollingTimeout
76+
// Pass root polling timeout to default test overrides to get it applied to all tests if not defined individually
77+
config.defaultTestOverrides.pollingTimeout = config.defaultTestOverrides.pollingTimeout ?? config.pollingTimeout
7878

7979
return config
8080
}

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,9 +1488,9 @@ __metadata:
14881488
languageName: node
14891489
linkType: hard
14901490

1491-
"@datadog/datadog-ci@npm:^2.33.0":
1492-
version: 2.33.0
1493-
resolution: "@datadog/datadog-ci@npm:2.33.0"
1491+
"@datadog/datadog-ci@npm:^2.35.0":
1492+
version: 2.35.0
1493+
resolution: "@datadog/datadog-ci@npm:2.35.0"
14941494
dependencies:
14951495
"@aws-sdk/client-cloudwatch-logs": ^3.537.0
14961496
"@aws-sdk/client-iam": ^3.535.0
@@ -1540,7 +1540,7 @@ __metadata:
15401540
yamux-js: 0.1.2
15411541
bin:
15421542
datadog-ci: dist/cli.js
1543-
checksum: bd2b66fbffb1a2b6d04b34ebc06e0fdc0bb48be86c3b6d9c2f6cc828b2bab4d881dbe1398fe39ea5a6b6921d7aef4ae6116c282c8c5efa23de515ac2ebab5683
1543+
checksum: 8f0e51cde69997f2584467dcd0eb89d1e49fc5d49c14599b54671cee52e0a07675a037b9e164fd7ebe3d5c70f9a0985495bb9b73612ec59bfa52d67fe0a2ca18
15441544
languageName: node
15451545
linkType: hard
15461546

@@ -3954,7 +3954,7 @@ __metadata:
39543954
resolution: "datadog-synthetics-github-action@workspace:."
39553955
dependencies:
39563956
"@actions/core": ^1.9.1
3957-
"@datadog/datadog-ci": ^2.33.0
3957+
"@datadog/datadog-ci": ^2.35.0
39583958
"@types/deep-extend": 0.4.32
39593959
"@types/jest": ^29.5.8
39603960
"@types/node": ^20.11.13

0 commit comments

Comments
 (0)