-
-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle scheduled request events in addons (#5403)
- Create 2 new events to replace the SCHEDULED_CHANGE_REQUEST_EXECUTED event - Handle the 3 events in slack-app and webhook addon definitions 3 events handled: - CHANGE_REQUEST_SCHEDULED - CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS - CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE Closes # [1-1555](https://linear.app/unleash/issue/1-1555/update-change-request-scheduled-and-scheduled-change-request-executed) Note: SCHEDULED_CHANGE_REQUEST_EXECUTED will be removed in follow up PR not to break current enterprise build --------- Signed-off-by: andreas-unleash <[email protected]>
- Loading branch information
1 parent
916e4c9
commit 2e17909
Showing
6 changed files
with
109 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ exports[`Should format specialised text for events when IPs changed 1`] = ` | |
} | ||
`; | ||
|
||
exports[`Should format specialised text for events when change request is scheduled 1`] = ` | ||
{ | ||
"text": "*[email protected]* scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature toggle *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* to be applied at in project *my-other-project*", | ||
"url": "unleashUrl/projects/my-other-project/change-requests/1", | ||
} | ||
`; | ||
|
||
exports[`Should format specialised text for events when constraints and rollout percentage and stickiness changed 1`] = ` | ||
{ | ||
"text": "*[email protected]* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* stickiness from default to random; rollout from 67% to 32%; constraints from empty set of constraints to [appName is one of (x,y)]", | ||
|
@@ -154,6 +161,20 @@ exports[`Should format specialised text for events when rollout percentage chang | |
} | ||
`; | ||
|
||
exports[`Should format specialised text for events when scheduled change request fails 1`] = ` | ||
{ | ||
"text": "*Failed* to apply the scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature toggle *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* by *[email protected]* in project *my-other-project*.", | ||
"url": "unleashUrl/projects/my-other-project/change-requests/1", | ||
} | ||
`; | ||
|
||
exports[`Should format specialised text for events when scheduled change request succeeds 1`] = ` | ||
{ | ||
"text": "*Successfully* applied the scheduled change request *[#1](unleashUrl/projects/my-other-project/change-requests/1)* for feature toggle *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in *production* environment in project *[my-other-project](unleashUrl/projects/my-other-project)* by *[email protected]* in project *my-other-project*.", | ||
"url": "unleashUrl/projects/my-other-project/change-requests/1", | ||
} | ||
`; | ||
|
||
exports[`Should format specialised text for events when stickiness changed 1`] = ` | ||
{ | ||
"text": "*[email protected]* updated *[new-feature](unleashUrl/projects/my-other-project/features/new-feature)* in project *[my-other-project](unleashUrl/projects/my-other-project)* by updating strategy *flexibleRollout* in *production* stickiness from default to random", | ||
|
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { | ||
CHANGE_REQUEST_SCHEDULED, | ||
CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE, | ||
CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS, | ||
FEATURE_STRATEGY_ADD, | ||
FEATURE_STRATEGY_REMOVE, | ||
FEATURE_STRATEGY_UPDATE, | ||
|
@@ -481,6 +484,57 @@ const testCases: [string, IEvent][] = [ | |
environment: 'production', | ||
}, | ||
], | ||
[ | ||
'when change request is scheduled', | ||
{ | ||
id: 920, | ||
type: CHANGE_REQUEST_SCHEDULED, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
changeRequestId: 1, | ||
}, | ||
preData: {}, | ||
tags: [], | ||
featureName: 'new-feature', | ||
project: 'my-other-project', | ||
environment: 'production', | ||
}, | ||
], | ||
[ | ||
'when scheduled change request succeeds ', | ||
{ | ||
id: 920, | ||
type: CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
changeRequestId: 1, | ||
}, | ||
preData: {}, | ||
tags: [], | ||
featureName: 'new-feature', | ||
project: 'my-other-project', | ||
environment: 'production', | ||
}, | ||
], | ||
[ | ||
'when scheduled change request fails ', | ||
{ | ||
id: 920, | ||
type: CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
changeRequestId: 1, | ||
}, | ||
preData: {}, | ||
tags: [], | ||
featureName: 'new-feature', | ||
project: 'my-other-project', | ||
environment: 'production', | ||
}, | ||
], | ||
]; | ||
|
||
testCases.forEach(([description, event]) => | ||
|
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
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