Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option threshold abortOnFail does not work with k6-operator #189

Closed
Slm0n87 opened this issue Feb 3, 2023 · 1 comment
Closed

Option threshold abortOnFail does not work with k6-operator #189

Slm0n87 opened this issue Feb 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Slm0n87
Copy link

Slm0n87 commented Feb 3, 2023

Brief summary

I wants to use the abortOnFail: true feature for a threshold to let K6 abort the test if my threshold was exceeded.
The following K6 file

k6-operator version or image

gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0,ghcr.io/grafana/operator:latest

K6 YAML

configmap:

import http from 'k6/http';
import { check } from 'k6';
import { sleep } from "k6";

export const options = {
  stages: [
    { target: 200, duration: '1m' },
    { target: 0, duration: '30s' },
  ],
  thresholds: {
    http_req_duration: [{ threshold: 'p(95) < 500', abortOnFail: true }],
  },
};

export default function () {
  const result = http.get('https://test-api.k6.io/public/crocodiles/');
  check(result, {
    'http response status code is 200': result.status === 200,
  });
  sleep(0.1);
}

K6 Yaml:

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: k6-sample
spec:
  parallelism: 4
  separate: true
  script:
    configMap:
      name: crocodile-stress-test
      file: test_treshold.js

Other environment details (if applicable)

No response

Steps to reproduce the problem

Apply the test script, apply the configmap.

Expected behaviour

test script should run at k8s same as tested locally by "k6 run <script>"

Actual behaviour

k6-operator-controller-manager can not start the test.
Logs:

manager } {"namespace": "k6", "name": "k6-sample", "error": "json: cannot unmarshal object into Go struct field InspectOutput.thresholds of type string"} │
│ manager github.com/go-logr/zapr.(*zapLogger).Error │
│ manager /go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128 │
│ manager github.com/grafana/k6-operator/controllers.RunValidations │
│ manager /workspace/controllers/k6_initialize.go:137 │
│ manager github.com/grafana/k6-operator/controllers.(*K6Reconciler).Reconcile │
│ manager /workspace/controllers/k6_controller.go:75 │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler │
│ manager /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/internal/controller/controller.go:235 │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem │
│ manager /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/internal/controller/controller.go:209 │
│ manager sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker │
│ manager /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/internal/controller/controller.go:188 │
│ manager k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1 │
│ manager /go/pkg/mod/k8s.io/apimachinery@v0.18.6/pkg/util/wait/wait.go:155 │
│ manager k8s.io/apimachinery/pkg/util/wait.BackoffUntil │
│ manager /go/pkg/mod/k8s.io/apimachinery@v0.18.6/pkg/util/wait/wait.go:156 │
│ manager k8s.io/apimachinery/pkg/util/wait.JitterUntil │
│ manager /go/pkg/mod/k8s.io/apimachinery@v0.18.6/pkg/util/wait/wait.go:133 │
│ manager k8s.io/apimachinery/pkg/util/wait.Until │
│ manager /go/pkg/mod/k8s.io/apimachinery@v0.18.6/pkg/util/wait/wait.go:90 │
│ manager 2023-02-03T11:31:12.962Z ERROR controller Reconciler error {"reconcilerGroup": "k6.io", "reconcilerKind": "K6", "controller": "k6", "name": "k6-sample", "namespace": "k6", "error": │
│ manager github.com/go-logr/zapr.(*zapLogger).Error`

@Slm0n87 Slm0n87 added the bug Something isn't working label Feb 3, 2023
@yorugac
Copy link
Collaborator

yorugac commented Feb 7, 2023

Hi @Slm0n87, thank you for opening the issue. Actually, the fix for this was merged in just last week in #176 - please try the newest release of the operator.

@yorugac yorugac closed this as completed Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants