Skip to content

Commit

Permalink
k6/disruptor: minor style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nadiamoe committed Jul 19, 2023
1 parent ceb4b90 commit 6e1469e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion k6/disruptor/01.basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const scenarios = {
startTime: "10s",
},
};

if (__ENV.DISABLE_DISRUPT) {
delete scenarios["disrupt"];
}
Expand All @@ -26,7 +27,7 @@ export const options = {
};

export function disrupt(data) {
const disruptor = new ServiceDisruptor("pizza-info", "pizza-ns");
const disruptor = new ServiceDisruptor("quickpizza-catalog", "default");
const targets = disruptor.targets();
if (targets.length == 0) {
throw new Error("expected list to have one target");
Expand All @@ -44,17 +45,20 @@ export default function () {
max_number_of_toppings: 6,
min_number_of_toppings: 2,
};

let res = http.post(`${BASE_URL}/api/pizza`, JSON.stringify(restrictions), {
headers: {
"Content-Type": "application/json",
"X-User-ID": 23423,
},
});
check(res, { "status is 200": (res) => res.status === 200 });

console.log(
`${res.json().pizza.name} (${
res.json().pizza.ingredients.length
} ingredients)`
);

sleep(1);
}

0 comments on commit 6e1469e

Please sign in to comment.