Skip to content

Commit

Permalink
Fix ruler query failure reporting (cortexproject/cortex#4335)
Browse files Browse the repository at this point in the history
* This patch tries to fix problem with user-errors reported as internal errors, and adds integration test for it.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* Allow passing custom error-wrapping function to ErrorTranslateQueryable.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* 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ý <peter.stibrany@grafana.com>

* Improve ruler test to check for more scenarios.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>

* CHANGELOG.md

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
  • Loading branch information
pstibrany committed Jul 20, 2021
1 parent 9d848d2 commit 36184cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 36184cd

Please sign in to comment.