From 36184cddab49efb129001c12750ac2c61c02f13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Tue, 20 Jul 2021 15:40:05 +0200 Subject: [PATCH] Fix ruler query failure reporting (https://github.com/cortexproject/cortex/pull/4335) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * This patch tries to fix problem with user-errors reported as internal errors, and adds integration test for it. Signed-off-by: Peter Štibraný * Allow passing custom error-wrapping function to ErrorTranslateQueryable. Signed-off-by: Peter Štibraný * Wrap errors returned by Queryable to custom wrapper. This allows us to distinguish between those errors and errors returned by PromQL engine, and react appropriately. Signed-off-by: Peter Štibraný * Improve ruler test to check for more scenarios. Signed-off-by: Peter Štibraný * CHANGELOG.md Signed-off-by: Peter Štibraný --- db/db.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/db/db.go b/db/db.go index fe6de79..ed397bb 100644 --- a/db/db.go +++ b/db/db.go @@ -14,18 +14,22 @@ const ( ) // NewMinio returns minio server, used as a local replacement for S3. -func NewMinio(port int, bktName string) *e2e.HTTPService { +func NewMinio(port int, bktNames ...string) *e2e.HTTPService { minioKESGithubContent := "https://raw.githubusercontent.com/minio/kes/master" commands := []string{ - "curl -sSL --tlsv1.2 -O '%s/root.key' -O '%s/root.cert'", - "mkdir -p /data/%s && minio server --address :%v --quiet /data", + fmt.Sprintf("curl -sSL --tlsv1.2 -O '%s/root.key' -O '%s/root.cert'", minioKESGithubContent, minioKESGithubContent), } + for _, bkt := range bktNames { + commands = append(commands, fmt.Sprintf("mkdir -p /data/%s", bkt)) + } + commands = append(commands, fmt.Sprintf("minio server --address :%v --quiet /data", port)) + m := e2e.NewHTTPService( fmt.Sprintf("minio-%v", port), images.Minio, // Create the "cortex" bucket before starting minio - e2e.NewCommandWithoutEntrypoint("sh", "-c", fmt.Sprintf(strings.Join(commands, " && "), minioKESGithubContent, minioKESGithubContent, bktName, port)), + e2e.NewCommandWithoutEntrypoint("sh", "-c", strings.Join(commands, " && ")), e2e.NewHTTPReadinessProbe(port, "/minio/health/ready", 200, 200), port, )