Skip to content

Commit 055ba78

Browse files
committed
use env vars
1 parent 1102200 commit 055ba78

File tree

5 files changed

+53
-9
lines changed

5 files changed

+53
-9
lines changed

performance-testing/uid2-operator/k6-test-resource.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ spec:
1515
value: "http://prometheus-server.prometheus/api/v1/write"
1616
- name: K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM
1717
value: "true"
18+
- name: OPERATOR_URL
19+
value: "operator_url"
20+
- name: CLIENT_KEY
21+
value: "client_key"
22+
- name: CLIENT_SECRET
23+
value: "client_secret"

performance-testing/uid2-operator/k6-token-generate-refresh-identitymap-keysharing.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { check } from 'k6';
55
import http from 'k6/http';
66

77
const vus = 300;
8-
const baseUrl = $OPERATOR_URL;
9-
const clientSecret = $CLIENT_SECRET;
10-
const clientKey = $CLIENT_KEY;
8+
const baseUrl = __ENV.OPERATOR_URL;
9+
const clientSecret = __ENV.CLIENT_SECRET;
10+
const clientKey = __ENV.CLIENT_KEY;
1111

1212
const generateVUs = vus;
1313
const refreshVUs = vus;

performance-testing/uid2-operator/k6-token-generate-refresh-identitymap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { check } from 'k6';
55
import http from 'k6/http';
66

77
const vus = 50;
8-
const baseUrl = $OPERATOR_URL;
9-
const clientSecret = $CLIENT_SECRET;
10-
const clientKey = $CLIENT_KEY;
8+
const baseUrl = __ENV.OPERATOR_URL;
9+
const clientSecret = __ENV.CLIENT_SECRET;
10+
const clientKey = __ENV.CLIENT_KEY;
1111

1212
const generateVUs = vus;
1313
const refreshVUs = vus;

performance-testing/uid2-operator/k6-token-generate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { check } from 'k6';
55
import http from 'k6/http';
66

77
const vus = 500;
8-
const baseUrl = $OPERATOR_URL;
9-
const clientSecret = $CLIENT_SECRET;
10-
const clientKey = $CLIENT_KEY;
8+
const baseUrl = __ENV.OPERATOR_URL;
9+
const clientSecret = __ENV.CLIENT_SECRET;
10+
const clientKey = __ENV.CLIENT_KEY;
1111

1212
const generateVUs = vus;
1313
const refreshVUs = vus;

performance-testing/uid2-operator/start-named-test.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,43 @@ cp ./k6-test-resource.yml ./k6-test-resource-edited.yml
1818
sed -i -e "s/replaced/$TEST_FILE/g" ./k6-test-resource-edited.yml
1919
sed -i -e "s/replacecomment/$COMMENT/g" ./k6-test-resource-edited.yml
2020

21+
operator_url_value=$OPERATOR_URL
22+
client_key_value=$CLIENT_KEY_VALUE
23+
client_secret_value=$CLIENT_SECRET_VALUE
24+
25+
if [[ -v operator_url_value ]]; then
26+
if [[ "$OPERATOR_URL" == *"/"* ]]; then
27+
operator_url_value=$(echo "$OPERATOR_URL" | sed 's/\//\\\//g')
28+
echo "Escaped OPERATOR_URL: $operator_url_value"
29+
else
30+
operator_url_value="$OPERATOR_URL"
31+
echo "OPERATOR_URL has no slashes: $operator_url_value"
32+
fi
33+
sed -i -e "s/operator_url/$operator_url_value/g" ./k6-test-resource-edited.yml
34+
fi
35+
36+
if [[ -v client_key_value ]]; then
37+
if [[ "$CLIENT_KEY" == *"/"* ]]; then
38+
client_key_value=$(echo "$CLIENT_KEY" | sed 's/\//\\\//g')
39+
echo "Escaped CLIENT_KEY: $client_key_value"
40+
else
41+
client_key_value="$CLIENT_KEY"
42+
echo "CLIENT_KEY has no slashes: $client_key_value"
43+
fi
44+
sed -i -e "s/client_key/$client_key_value/g" ./k6-test-resource-edited.yml
45+
fi
46+
47+
if [[ -v client_secret_value ]]; then
48+
if [[ "$CLIENT_SECRET" == *"/"* ]]; then
49+
client_secret_value=$(echo "$CLIENT_SECRET" | sed 's/\//\\\//g')
50+
echo "Escaped CLIENT_SECRET: $client_secret_value"
51+
else
52+
client_secret_value="$CLIENT_SECRET"
53+
echo "CLIENT_SECRET has no slashes: $client_secret_value"
54+
fi
55+
sed -i -e "s/client_secret/$client_secret_value/g" ./k6-test-resource-edited.yml
56+
fi
57+
58+
2159
kubectl create configmap operator-stress-test --from-file ./$TEST_FILE
2260
kubectl apply -f ./k6-test-resource-edited.yml

0 commit comments

Comments
 (0)