Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add specifications for custom stickiness #11

Merged
merged 3 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions specifications/12-custom-stickiness.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"name": "12-custom-stickiness",
"state": {
"version": 1,
"features": [
{
"name": "Feature.flexible.rollout.custom.stickiness_100",
"description": "Should support custom stickiness as option",
"enabled": true,
"strategies": [
{
"name": "flexibleRollout",
"parameters": {
"rollout": "100",
"stickiness": "customField",
"groupId": "Feature.flexible.rollout.custom.stickiness_100"
},
"constraints": []
}
],
"variants": [
{
"name": "blue",
"weight": 25,
"stickiness": "customField",
"payload": {
"type": "string",
"value": "val1"
}
},
{
"name": "red",
"weight": 25,
"stickiness": "customField",
"payload": {
"type": "string",
"value": "val1"
}
},
{
"name": "green",
"weight": 25,
"stickiness": "customField",
"payload": {
"type": "string",
"value": "val1"
}
},
{
"name": "yellow",
"weight": 25,
"stickiness": "customField",
"payload": {
"type": "string",
"value": "val1"
}
}
]
},
{
"name": "Feature.flexible.rollout.custom.stickiness_50",
"description": "Should support custom stickiness as option",
"enabled": true,
"strategies": [
{
"name": "flexibleRollout",
"parameters": {
"rollout": "50",
"stickiness": "customField",
"groupId": "Feature.flexible.rollout.custom.stickiness_50"
},
"constraints": []
}
]
}
]
},
"tests": [
{
"description": "Feature.flexible.rollout.custom.stickiness_100 should be enabled without field defined for 100%",
"context": {"customField": "any_value"},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": true
},
{
"description": "Feature.flexible.rollout.custom.stickiness_50 should not be enabled without custom field",
"context": {},
"toggleName": "Feature.flexible.rollout.custom.stickiness_50",
"expectedResult": false
},
{
"description": "Feature.flexible.rollout.custom.stickiness_50 should not enabled for customField=402",
"context": {
"customField": "402"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_50",
"expectedResult": false
},
{
"description": "Feature.flexible.rollout.custom.stickiness_50 should be enabled for customField=388",
"context": {
"customField": "388"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_50",
"expectedResult": true
},
{
"description": "Feature.flexible.rollout.custom.stickiness_50 should be enabled for customField=39",
"context": {
"customField": "39"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_50",
"expectedResult": true
}
],
"variantTests": [
{
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=528 yields blue",
"context": {
"customField": "528"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": {
"name": "blue",
"payload": {
"type": "string",
"value": "val1"
},
"enabled": true
}
},
{
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=16 yields blue",
"context": {
"customField": "16"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": {
"name": "blue",
"payload": {
"type": "string",
"value": "val1"
},
"enabled": true
}
},
{
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=198 yields red",
"context": {
"customField": "198"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": {
"name": "red",
"payload": {
"type": "string",
"value": "val1"
},
"enabled": true
}
},
{
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=43 yields green",
"context": {
"customField": "43"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": {
"name": "green",
"payload": {
"type": "string",
"value": "val1"
},
"enabled": true
}
},
{
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=112 yields yellow",
"context": {
"customField": "112"
},
"toggleName": "Feature.flexible.rollout.custom.stickiness_100",
"expectedResult": {
"name": "yellow",
"payload": {
"type": "string",
"value": "val1"
},
"enabled": true
}
}
]
}
3 changes: 2 additions & 1 deletion specifications/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"08-variants.json",
"09-strategy-constraints.json",
"10-flexible-rollout-strategy.json",
"11-strategy-constraints-edge-cases.json"
"11-strategy-constraints-edge-cases.json",
"12-custom-stickiness.json"
]