-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: [M3-8072] - Cloud changes for ad-hoc test pipeline (#11088)
* Delete 'region-1' Docker Compose service, deprecate 'e2e', 'e2e_heimdall', and 'component' services, and add 'cypress_local', 'cypress_remote', and 'cypress_component' * Set yarn as entrypoint for test runner in Dockerfile * Allow Cypress Slack notification title to be customized * Allow extra information to be displayed in Slack/GitHub notifications * Only show up to six failures in a Slack notification * Allow JUnit summary when there are no JUnit files in given path * Move LaunchDarkly URL matchers to constants file * Allow feature flags to be overridden via CY_TEST_FEATURE_FLAGS environment variable * Add changesets
- Loading branch information
1 parent
0036546
commit 35cd799
Showing
17 changed files
with
214 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11088-tech-stories-1729535071709.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
Replace 'e2e', 'e2e_heimdall', and 'component' Docker Compose services with 'cypress_local', 'cypress_remote', and 'cypress_component' ([#11088](https://github.com/linode/manager/pull/11088)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tests | ||
--- | ||
|
||
Allow overriding feature flags via CY_TEST_FEATURE_FLAGS environment variable ([#11088](https://github.com/linode/manager/pull/11088)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tests | ||
--- | ||
|
||
Allow pipeline Slack notifications to be customized ([#11088](https://github.com/linode/manager/pull/11088)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tests | ||
--- | ||
|
||
Show PR title in Slack CI notifications ([#11088](https://github.com/linode/manager/pull/11088)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/manager/cypress/support/constants/feature-flags.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @file Constants related to Cypress's handling of LaunchDarkly feature flags. | ||
*/ | ||
|
||
// LaunchDarkly URL pattern for feature flag retrieval. | ||
export const launchDarklyUrlPattern = | ||
'https://app.launchdarkly.com/sdk/evalx/*/contexts/*'; | ||
|
||
// LaunchDarkly URL pattern for feature flag / event streaming. | ||
export const launchDarklyClientstreamPattern = | ||
'https://clientstream.launchdarkly.com/eval/*/*'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/manager/cypress/support/plugins/feature-flag-override.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { CypressPlugin } from './plugin'; | ||
|
||
/** | ||
* Handles setup related to Launch Darkly feature flag overrides. | ||
* | ||
* Checks if the user has passed overrides via the `CY_TEST_FEATURE_FLAGS` env, | ||
* and validates its value if so by attempting to parse it as JSON. If that | ||
* succeeds, the parsed override object is exposed to Cypress via the | ||
* `featureFlagOverrides` config. | ||
*/ | ||
export const featureFlagOverrides: CypressPlugin = (_on, config) => { | ||
const featureFlagOverridesJson = config.env?.['CY_TEST_FEATURE_FLAGS']; | ||
|
||
let featureFlagOverrides = undefined; | ||
if (featureFlagOverridesJson) { | ||
const notice = | ||
'Feature flag overrides are enabled with the following JSON payload:'; | ||
const jsonWarning = | ||
'Be aware that malformed or invalid feature flag data can trigger crashes and other unexpected behavior.'; | ||
|
||
console.info(`${notice}\n\n${featureFlagOverridesJson}\n\n${jsonWarning}`); | ||
|
||
try { | ||
featureFlagOverrides = JSON.parse(featureFlagOverridesJson); | ||
} catch (e) { | ||
throw new Error( | ||
`Unable to parse feature flag JSON:\n\n${featureFlagOverridesJson}\n\nPlease double check your 'CY_TEST_FEATURE_FLAGS' value and try again.` | ||
); | ||
} | ||
} | ||
|
||
return { | ||
...config, | ||
env: { | ||
...config.env, | ||
featureFlagOverrides, | ||
}, | ||
}; | ||
}; |
37 changes: 37 additions & 0 deletions
37
packages/manager/cypress/support/setup/mock-feature-flags-request.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @file Intercepts and mocks Launch Darkly feature flag requests with override data if specified. | ||
*/ | ||
|
||
import { launchDarklyUrlPattern } from 'support/constants/feature-flags'; | ||
|
||
/** | ||
* If feature flag overrides have been specified, intercept every LaunchDarkly | ||
* feature flag request and modify the response to contain the override data. | ||
* | ||
* This override happens before other intercepts and mocks (e.g. via `mockGetFeatureFlags` | ||
* and `mockAppendFeatureFlags`), so mocks set up by those functions will take | ||
* priority in the event that both modify the same feature flag value. | ||
*/ | ||
export const mockFeatureFlagRequests = () => { | ||
const featureFlagOverrides = Cypress.env('featureFlagOverrides'); | ||
|
||
if (featureFlagOverrides) { | ||
beforeEach(() => { | ||
cy.intercept( | ||
{ | ||
middleware: true, | ||
url: launchDarklyUrlPattern, | ||
}, | ||
(req) => { | ||
req.on('before:response', (res) => { | ||
const overriddenFeatureFlagData = { | ||
...res.body, | ||
...featureFlagOverrides, | ||
}; | ||
res.body = overriddenFeatureFlagData; | ||
}); | ||
} | ||
); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.