diff options
| author | 石昌林 <changlin.shi@ly.com> | 2022-06-20 12:35:29 +0800 |
|---|---|---|
| committer | 石昌林 <changlin.shi@ly.com> | 2022-06-20 12:35:29 +0800 |
| commit | 9e036df3566e842710ea2b0ed3ad28f5af2a1885 (patch) | |
| tree | ce4372cc6fb95f122bd5b90df6bfe114589603d4 /weed/shell/command_s3_circuitbreaker_test.go | |
| parent | 3dd60529c517d6cabfb5ff513013680678d8d3ff (diff) | |
| download | seaweedfs-9e036df3566e842710ea2b0ed3ad28f5af2a1885.tar.xz seaweedfs-9e036df3566e842710ea2b0ed3ad28f5af2a1885.zip | |
remove go.uber.org/atomic
Diffstat (limited to 'weed/shell/command_s3_circuitbreaker_test.go')
| -rw-r--r-- | weed/shell/command_s3_circuitbreaker_test.go | 157 |
1 files changed, 129 insertions, 28 deletions
diff --git a/weed/shell/command_s3_circuitbreaker_test.go b/weed/shell/command_s3_circuitbreaker_test.go index 191a62e6a..3d0b4ac6e 100644 --- a/weed/shell/command_s3_circuitbreaker_test.go +++ b/weed/shell/command_s3_circuitbreaker_test.go @@ -17,13 +17,13 @@ var ( TestCases = []*Case{ //add circuit breaker config for global { - args: strings.Split("-global -type count -actions Read,Write -values 500,200", " "), + args: strings.Split("-global -type Count -actions Read,Write -values 500,200", " "), result: `{ "global": { "enabled": true, "actions": { - "Read:count": "500", - "Write:count": "200" + "Read:Count": "500", + "Write:Count": "200" } } }`, @@ -35,8 +35,8 @@ var ( result: `{ "global": { "actions": { - "Read:count": "500", - "Write:count": "200" + "Read:Count": "500", + "Write:Count": "200" } } }`, @@ -44,34 +44,34 @@ var ( //add circuit breaker config for buckets x,y,z { - args: strings.Split("-buckets x,y,z -type count -actions Read,Write -values 200,100", " "), + args: strings.Split("-buckets x,y,z -type Count -actions Read,Write -values 200,100", " "), result: `{ "global": { "actions": { - "Read:count": "500", - "Write:count": "200" + "Read:Count": "500", + "Write:Count": "200" } }, "buckets": { "x": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } }, "y": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } }, "z": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } } } @@ -84,29 +84,29 @@ var ( result: `{ "global": { "actions": { - "Read:count": "500", - "Write:count": "200" + "Read:Count": "500", + "Write:Count": "200" } }, "buckets": { "x": { "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } }, "y": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } }, "z": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } } } @@ -119,23 +119,124 @@ var ( result: `{ "global": { "actions": { - "Read:count": "500", - "Write:count": "200" + "Read:Count": "500", + "Write:Count": "200" } }, "buckets": { "y": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" } }, "z": { "enabled": true, "actions": { - "Read:count": "200", - "Write:count": "100" + "Read:Count": "200", + "Write:Count": "100" + } + } + } + }`, + }, + + //configure the circuit breaker for the size of the uploaded file for bucket x,y + { + args: strings.Split("-buckets x,y -type MB -actions Write -values 1024", " "), + result: `{ + "global": { + "actions": { + "Read:Count": "500", + "Write:Count": "200" + } + }, + "buckets": { + "x": { + "enabled": true, + "actions": { + "Write:MB": "1073741824" + } + }, + "y": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100", + "Write:MB": "1073741824" + } + }, + "z": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100" + } + } + } + }`, + }, + + //delete the circuit breaker configuration for the size of the uploaded file of bucket x,y + { + args: strings.Split("-buckets x,y -type MB -actions Write -delete", " "), + result: `{ + "global": { + "actions": { + "Read:Count": "500", + "Write:Count": "200" + } + }, + "buckets": { + "x": { + "enabled": true + }, + "y": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100" + } + }, + "z": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100" + } + } + } + }`, + }, + + //enable global circuit breaker config (without -disable flag) + { + args: strings.Split("-global", " "), + result: `{ + "global": { + "enabled": true, + "actions": { + "Read:Count": "500", + "Write:Count": "200" + } + }, + "buckets": { + "x": { + "enabled": true + }, + "y": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100" + } + }, + "z": { + "enabled": true, + "actions": { + "Read:Count": "200", + "Write:Count": "100" } } } |
