Skip to content

Commit

Permalink
disrupted done in makefile
Browse files Browse the repository at this point in the history
Signed-off-by: almudena vivanco <[email protected]>
  • Loading branch information
almudena vivanco committed Oct 30, 2023
1 parent b2b3dcb commit 0df171b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TF_GRAFANA_PROMETHEUS_USER ?= user
TF_GRAFANA_PROMETHEUS_PASSWORD ?= password
TF_GRAFANA_TOKEN ?= token

INJECT_FAULTS ?= 1
INJECT_FAULTS ?= 0

KEDA_VERSION ?= main

Expand Down
18 changes: 9 additions & 9 deletions tests/test-scaledobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ServiceDisruptor } from "k6/x/disruptor";

const TrendKEDAInternalLatency = utils.generateTrend(
"keda_internal_latency",
true,
true
);

export const options = {
Expand Down Expand Up @@ -42,7 +42,7 @@ export function setup() {
for (let i = 0; i < scaledObjectCount; i++) {
kubernetes.applyManifest(workload.getWorkloadDeploymentManifest(i));
kubernetes.applyManifest(
workload.getWorkloadScaledObjectManifest(i, metricsPerScaledObject),
workload.getWorkloadScaledObjectManifest(i, metricsPerScaledObject)
);
}

Expand All @@ -52,7 +52,7 @@ export function setup() {
"scaled_object",
scaledObjectCount,
20,
15,
15
);

// Wait a minute to stabilizate prometheus metrics before the test
Expand All @@ -62,7 +62,7 @@ export function setup() {

export default function () {
workload.setExecutionPrefix(
utils.generatePrefix(exec.test.options.ext.loadimpact.name),
utils.generatePrefix(exec.test.options.ext.loadimpact.name)
);
var lags = prometheus.getLags(workload.getNamespaceName());
lags.forEach((lag) => {
Expand All @@ -72,7 +72,7 @@ export default function () {
}

export function disrupt(data) {
if (__ENV.INJECT_FAULTS != "0") {
if (__ENV.INJECT_FAULTS != "1") {
return;
}

Expand All @@ -82,19 +82,19 @@ export function disrupt(data) {
};

mock.setExecutionPrefix(
utils.generatePrefix(exec.test.options.ext.loadimpact.name),
utils.generatePrefix(exec.test.options.ext.loadimpact.name)
);
const svcDisruptor = new ServiceDisruptor(
"mock-service",
mock.getNamespaceName(),
mock.getNamespaceName()
);
svcDisruptor.injectHTTPFaults(fault, "120s", { ProxyPort: 8000 });
}

export function teardown() {
console.log(`Starting teardown`);
const casePrefix = utils.generatePrefix(
exec.test.options.ext.loadimpact.name,
exec.test.options.ext.loadimpact.name
);
mock.setExecutionPrefix(casePrefix);
workload.setExecutionPrefix(casePrefix);
Expand All @@ -107,7 +107,7 @@ export function teardown() {
"scaled_object",
0,
20,
15,
15
);
});
}

0 comments on commit 0df171b

Please sign in to comment.