From 9030d7cf9cd58e29ed485e5771f135ab9363a69f Mon Sep 17 00:00:00 2001 From: Grzegorz Zagata Date: Mon, 16 Oct 2023 08:20:07 +0200 Subject: [PATCH] add local proxy server to simulate throttling --- docker-compose.yml | 15 +++++++ ...eBucketNotFoundDuringMultipartUpload.jsonc | 39 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 mockServer/simulateBucketNotFoundDuringMultipartUpload.jsonc diff --git a/docker-compose.yml b/docker-compose.yml index 548d56f8..ee64c56a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/mockServer/simulateBucketNotFoundDuringMultipartUpload.jsonc b/mockServer/simulateBucketNotFoundDuringMultipartUpload.jsonc new file mode 100644 index 00000000..36d43a0a --- /dev/null +++ b/mockServer/simulateBucketNotFoundDuringMultipartUpload.jsonc @@ -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, + }, +] \ No newline at end of file