Skip to content

Commit

Permalink
add local proxy server to simulate throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
Grekkq committed Oct 16, 2023
1 parent 2ef7cd3 commit 9030d7c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
version: "3"
services:

mockServer:
image: mockserver/mockserver:5.14.0
ports:
- 1080:1080
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
MOCKSERVER_WATCH_INITIALIZATION_JSON: "true"
MOCKSERVER_PROPERTY_FILE: /config/mockserver.properties
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/simulateBucketNotFoundDuringMultipartUpload.jsonc
volumes:
- type: bind
source: ./mockServer
target: /config

ceph:
image: ceph/daemon:v3.0.5-stable-3.0-luminous-centos-7
environment:
Expand Down
39 changes: 39 additions & 0 deletions mockServer/simulateBucketNotFoundDuringMultipartUpload.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// To use this configuration make sure it is selected as MOCKSERVER_INITIALIZATION_JSON_PATH and switch rokku to go through proxy port: 1080
// Remember to disable `updateBucketCredentials` so rokku will try to refetch bucket location before each request and to enable rokku multiple namespace feature
[
{
// Allow first few requests to start multipart upload
"httpRequest": {
"method": "GET"
},
"httpForward": {
"host": "host.docker.internal",
"port": 8010,
"scheme": "HTTP"
},
"times": {
"remainingTimes": 4,
"unlimited": false
},
"priority": 20,
},
{
// Simulate rate limiting
"httpRequest": {
"method": "GET"
},
"httpResponse": {
"statusCode": 503,
},
"priority": 10,
},
{
// allow all other requests
"httpForward": {
"host": "host.docker.internal",
"port": 8010,
"scheme": "HTTP"
},
"priority": 0,
},
]

0 comments on commit 9030d7c

Please sign in to comment.