diff --git a/cmd/mockbackend/testcases/render_error_all/render_error_all.yaml b/cmd/mockbackend/testcases/render_error_all/render_error_all.yaml index 133245123..0bc255177 100644 --- a/cmd/mockbackend/testcases/render_error_all/render_error_all.yaml +++ b/cmd/mockbackend/testcases/render_error_all/render_error_all.yaml @@ -14,9 +14,9 @@ test: httpCode: 200 contentType: "application/json" expectedResults: - - metrics: - - target: "a" - datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] + - metrics: + - target: "a" + datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] # empty - endpoint: "http://127.0.0.1:8081" @@ -33,9 +33,9 @@ test: httpCode: 200 contentType: "application/json" expectedResults: - - metrics: - - target: "a" - datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] + - metrics: + - target: "a" + datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] # timeout - endpoint: "http://127.0.0.1:8081" diff --git a/cmd/mockbackend/testcases/render_error_all_rr/carbonapi.yaml b/cmd/mockbackend/testcases/render_error_all_rr/carbonapi.yaml new file mode 100644 index 000000000..6c7cf2e6e --- /dev/null +++ b/cmd/mockbackend/testcases/render_error_all_rr/carbonapi.yaml @@ -0,0 +1,59 @@ +listen: "localhost:8081" +expvar: + enabled: true + pprofEnabled: false + listen: "" +concurency: 1000 +notFoundStatusCode: 200 +cache: + type: "mem" + size_mb: 0 + defaultTimeoutSec: 60 +cpus: 0 +tz: "" +maxBatchSize: 0 +graphite: + host: "" + interval: "60s" + prefix: "carbon.api" + pattern: "{prefix}.{fqdn}" +idleConnections: 10 +pidFile: "" +upstreams: + requireSuccessAll: true + buckets: 10 + timeouts: + find: "2s" + render: "10s" + connect: "200ms" + concurrencyLimitPerServer: 0 + keepAliveInterval: "30s" + maxIdleConnsPerHost: 100 + backendsv2: + backends: + - + groupName: "mock-001" + protocol: "auto" + lbMethod: "rr" + maxTries: 2 + maxBatchSize: 0 + keepAliveInterval: "10s" + concurrencyLimit: 0 + forceAttemptHTTP2: true + maxIdleConnsPerHost: 1000 + timeouts: + find: "3s" + render: "5s" + connect: "200ms" + servers: + - "http://127.0.0.1:9070" + - "http://127.0.0.1:9071" + graphite09compat: false +expireDelaySec: 10 +logger: + - logger: "" + file: "stderr" + level: "debug" + encoding: "console" + encodingTime: "iso8601" + encodingDuration: "seconds" diff --git a/cmd/mockbackend/testcases/render_error_all_rr/render_error_all_rr.yaml b/cmd/mockbackend/testcases/render_error_all_rr/render_error_all_rr.yaml new file mode 100644 index 000000000..3e9b4c898 --- /dev/null +++ b/cmd/mockbackend/testcases/render_error_all_rr/render_error_all_rr.yaml @@ -0,0 +1,137 @@ +version: "v1" +test: + apps: + - name: "carbonapi" + binary: "./carbonapi" + args: + - "-config" + - "./cmd/mockbackend/testcases/render_error_all_rr/carbonapi.yaml" + queries: + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=a&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + expectedResults: + - metrics: + - target: "a" + datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] + + # empty + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=b&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=a&target=b&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + expectedResults: + - metrics: + - target: "a" + datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] + + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=c&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + expectedResults: + - metrics: + - target: "c" + datapoints: [[0,1],[1,2],[2,3],[2,4],[4,5]] + + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=a&target=b&target=c&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + expectedResults: + - metrics: + - target: "a" + datapoints: [[0,1],[1,2],[2,3],[2,4],[3,5]] + - target: "c" + datapoints: [[0,1],[1,2],[2,3],[2,4],[4,5]] + + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=divideSeries(a,c)&format=json" + expectedResponse: + httpCode: 200 + contentType: "application/json" + expectedResults: + - metrics: + - target: "divideSeries(a,c)" + tags: {"name": "a"} + datapoints: [[NaN,1],[1,2],[1,3],[1,4],[0.75,5]] + + # 503 + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=d&format=json" + expectedResponse: + httpCode: 503 + contentType: "text/plain; charset=utf-8" + + # partial success + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=a&target=d&format=json" + expectedResponse: + httpCode: 503 + contentType: "text/plain; charset=utf-8" + + # partial success + # TODO: must fail, target d failed + - endpoint: "http://127.0.0.1:8081" + type: "GET" + URL: "/render/?target=divideSeries(a,d)&format=json" + expectedResponse: + httpCode: 503 + contentType: "text/plain; charset=utf-8" + +listeners: + - address: ":9070" + expressions: + "a": + pathExpression: "a" + emptyBody: true + code: 503 + + # 503 + "c": + pathExpression: "c" + mptyBody: true + code: 503 + + "d": + pathExpression: "d" + emptyBody: true + code: 503 + + - address: ":9071" + expressions: + "a": + pathExpression: "a" + data: + - metricName: "a" + values: [0,1,2,2,3] + + "c": + pathExpression: "c" + data: + - metricName: "c" + values: [0,1,2,2,4] + + "d": + pathExpression: "d" + emptyBody: true + code: 503 \ No newline at end of file