Skip to content

Commit 37f0a9f

Browse files
authored
Merge pull request #55 from IABTechLab/gdm-UID2-4845-core-load-testing
Updated core load test scripts to match Grafana Cloud
2 parents 126ed1f + b44a151 commit 37f0a9f

File tree

3 files changed

+315
-0
lines changed

3 files changed

+315
-0
lines changed

.trivyignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ CVE-2024-47535
88

99
# https://thetradedesk.atlassian.net/browse/UID2-4461
1010
CVE-2024-7254
11+
12+
# https://thetradedesk.atlassian.net/browse/UID2-4874
13+
CVE-2025-24970
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import http from 'k6/http';
2+
3+
const CORE_API_TOKEN = "UID2-O-L-999-dp9Dt0.JVoGpynN4J8nMA7FxmzsavxJa8B9H74y9xdEE="; // Mock token for E2E tests
4+
const CORE_BASE_URL = 'http://localhost:8088';
5+
6+
const AUTH_HEADERS = { headers: { 'Authorization': `Bearer ${CORE_API_TOKEN}` }};
7+
const HEADERS = { headers: { ...AUTH_HEADERS.headers, 'X-UID2-AppVersion': 'uid2-operator=0.0.0-local-load-test' }};
8+
9+
const STAGE_DURATION = '120s';
10+
const STAGE_LOAD_MULTIPLIER = [
11+
1,
12+
2,
13+
5,
14+
10,
15+
];
16+
17+
export const options = {
18+
scenarios: {
19+
ops_healthcheck: {
20+
executor: 'ramping-arrival-rate',
21+
exec: 'opsHealthcheck',
22+
startRate: 4,
23+
timeUnit: '1s',
24+
preAllocatedVUs: 1000,
25+
maxVUs: 1000,
26+
stages: getStages(4),
27+
},
28+
29+
attest: {
30+
executor: 'ramping-arrival-rate',
31+
exec: 'attest',
32+
startRate: 1,
33+
timeUnit: '1s',
34+
preAllocatedVUs: 1000,
35+
maxVUs: 1000,
36+
stages: getStages(1),
37+
},
38+
39+
clients_refresh: {
40+
executor: 'ramping-arrival-rate',
41+
exec: 'clientsRefresh',
42+
startRate: 1,
43+
timeUnit: '1s',
44+
preAllocatedVUs: 1000,
45+
maxVUs: 1000,
46+
stages: getStages(16),
47+
},
48+
keysets_refresh: {
49+
executor: 'ramping-arrival-rate',
50+
exec: 'keysetRefresh',
51+
startRate: 1,
52+
timeUnit: '1s',
53+
preAllocatedVUs: 1000,
54+
maxVUs: 1000,
55+
stages: getStages(16),
56+
},
57+
keyset_keys_refresh: {
58+
executor: 'ramping-arrival-rate',
59+
exec: 'keysetKeysRefresh',
60+
startRate: 1,
61+
timeUnit: '1s',
62+
preAllocatedVUs: 1000,
63+
maxVUs: 1000,
64+
stages: getStages(16),
65+
},
66+
salt_refresh: {
67+
executor: 'ramping-arrival-rate',
68+
exec: 'saltRefresh',
69+
startRate: 1,
70+
timeUnit: '1s',
71+
preAllocatedVUs: 1000,
72+
maxVUs: 1000,
73+
stages: getStages(16),
74+
},
75+
76+
sites_refresh: {
77+
executor: 'ramping-arrival-rate',
78+
exec: 'sitesRefresh',
79+
startRate: 1,
80+
timeUnit: '1s',
81+
preAllocatedVUs: 1000,
82+
maxVUs: 1000,
83+
stages: getStages(9),
84+
},
85+
cstg_refresh: {
86+
executor: 'ramping-arrival-rate',
87+
exec: 'clientSideKeypairsRefresh',
88+
startRate: 1,
89+
timeUnit: '1s',
90+
preAllocatedVUs: 1000,
91+
maxVUs: 1000,
92+
stages: getStages(9),
93+
},
94+
services_refresh: {
95+
executor: 'ramping-arrival-rate',
96+
exec: 'servicesRefresh',
97+
startRate: 1,
98+
timeUnit: '1s',
99+
preAllocatedVUs: 1000,
100+
maxVUs: 1000,
101+
stages: getStages(9),
102+
},
103+
service_links_refresh: {
104+
executor: 'ramping-arrival-rate',
105+
exec: 'serviceLinksRefresh',
106+
startRate: 1,
107+
timeUnit: '1s',
108+
preAllocatedVUs: 1000,
109+
maxVUs: 1000,
110+
stages: getStages(9),
111+
},
112+
},
113+
};
114+
115+
function getStages(qps) {
116+
return STAGE_LOAD_MULTIPLIER.map(loadMultiplier => ({
117+
duration: STAGE_DURATION,
118+
target: qps * loadMultiplier
119+
}));
120+
}
121+
122+
// Scenarios
123+
export async function opsHealthcheck(data) {
124+
http.get(`${CORE_BASE_URL}/ops/healthcheck`);
125+
}
126+
127+
export async function attest(data) {
128+
const validTrustedAttestationRequest = '{"attestation_request":"AA==","public_key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl7kXK1wf15V9HgkQhbMK2nfJGbudmdXNrX7MZjFm07z6eEjaQsuqMteQumLRwn+RxEcXKVaxBAE3RQTFL9XsZc2OtRKOU+oMIQep8tmPFMgh83BzjLs5O5HZf510geFJO6qRqc3UHJT3ACxE7IkmRx1JIKFKPzTrthHdb2+D7bdJBPsVbwk7y+a36f5jvELGGzMC89LAvd7JpOmGsCAj6jwiEAKmmLId9bfe0YeLuebl95VfSzrQVdz82oGGQKXuJgKZtc/Xp1omZ9spm+zzVFJzsimxDdGdnaWMnas43VoTE04JDt+pucJTTbftIvu05frwkbZh3sQ2yBu5gBP7YwIDAQAB","application_name":"uid2-operator","application_version":"5.27.10-3f25586306","components":{"uid2-attestation-api":"2.0.0-f968aec0e3","uid2-shared":"7.2.4-SNAPSHOT"}}';
129+
http.post(`${CORE_BASE_URL}/attest`, validTrustedAttestationRequest, AUTH_HEADERS);
130+
}
131+
132+
export async function clientsRefresh(data) {
133+
http.get(`${CORE_BASE_URL}/clients/refresh`, HEADERS);
134+
}
135+
136+
export async function keysetRefresh(data) {
137+
http.get(`${CORE_BASE_URL}/key/keyset/refresh`, HEADERS);
138+
}
139+
140+
export async function keysetKeysRefresh(data) {
141+
http.get(`${CORE_BASE_URL}/key/keyset-keys/refresh`, HEADERS);
142+
}
143+
144+
export async function saltRefresh(data) {
145+
http.get(`${CORE_BASE_URL}/salt/refresh`, HEADERS);
146+
}
147+
148+
export async function sitesRefresh(data) {
149+
http.get(`${CORE_BASE_URL}/sites/refresh`, HEADERS);
150+
}
151+
152+
export async function clientSideKeypairsRefresh(data) {
153+
http.get(`${CORE_BASE_URL}/client_side_keypairs/refresh`, HEADERS);
154+
}
155+
156+
export async function servicesRefresh(data) {
157+
http.get(`${CORE_BASE_URL}/services/refresh`, HEADERS);
158+
}
159+
160+
export async function serviceLinksRefresh(data) {
161+
http.get(`${CORE_BASE_URL}/service_links/refresh`, HEADERS);
162+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
import http from 'k6/http';
2+
3+
const CORE_API_TOKEN = "UID2-O-L-999-dp9Dt0.JVoGpynN4J8nMA7FxmzsavxJa8B9H74y9xdEE="; // Mock token for E2E tests
4+
const CORE_BASE_URL = 'http://localhost:8088';
5+
6+
const AUTH_HEADERS = { headers: { 'Authorization': `Bearer ${CORE_API_TOKEN}` }};
7+
const HEADERS = { headers: { ...AUTH_HEADERS.headers, 'X-UID2-AppVersion': 'uid2-operator=0.0.0-local-load-test' }};
8+
9+
const DURATION = '1m';
10+
const RATE_MULTIPLIER = 10;
11+
12+
export const options = {
13+
scenarios: {
14+
ops_healthcheck: {
15+
executor: 'constant-arrival-rate',
16+
exec: 'opsHealthcheck',
17+
duration: DURATION,
18+
rate: 4 * RATE_MULTIPLIER,
19+
timeUnit: '1s',
20+
preAllocatedVUs: 1000,
21+
maxVUs: 1000,
22+
},
23+
24+
attest: {
25+
executor: 'constant-arrival-rate',
26+
exec: 'attest',
27+
duration: DURATION,
28+
rate: 1 * RATE_MULTIPLIER,
29+
timeUnit: '1s',
30+
preAllocatedVUs: 1000,
31+
maxVUs: 1000,
32+
},
33+
34+
clients_refresh: {
35+
executor: 'constant-arrival-rate',
36+
exec: 'clientsRefresh',
37+
duration: DURATION,
38+
rate: 16 * RATE_MULTIPLIER,
39+
timeUnit: '1s',
40+
preAllocatedVUs: 1000,
41+
maxVUs: 1000,
42+
},
43+
keysets_refresh: {
44+
executor: 'constant-arrival-rate',
45+
exec: 'keysetRefresh',
46+
duration: DURATION,
47+
rate: 16 * RATE_MULTIPLIER,
48+
timeUnit: '1s',
49+
preAllocatedVUs: 1000,
50+
maxVUs: 1000,
51+
},
52+
keyset_keys_refresh: {
53+
executor: 'constant-arrival-rate',
54+
exec: 'keysetKeysRefresh',
55+
duration: DURATION,
56+
rate: 16 * RATE_MULTIPLIER,
57+
timeUnit: '1s',
58+
preAllocatedVUs: 1000,
59+
maxVUs: 1000,
60+
},
61+
salt_refresh: {
62+
executor: 'constant-arrival-rate',
63+
exec: 'saltRefresh',
64+
duration: DURATION,
65+
rate: 16 * RATE_MULTIPLIER,
66+
timeUnit: '1s',
67+
preAllocatedVUs: 1000,
68+
maxVUs: 1000,
69+
},
70+
71+
sites_refresh: {
72+
executor: 'constant-arrival-rate',
73+
exec: 'sitesRefresh',
74+
duration: DURATION,
75+
rate: 9 * RATE_MULTIPLIER,
76+
timeUnit: '1s',
77+
preAllocatedVUs: 1000,
78+
maxVUs: 1000,
79+
},
80+
cstg_refresh: {
81+
executor: 'constant-arrival-rate',
82+
exec: 'clientSideKeypairsRefresh',
83+
duration: DURATION,
84+
rate: 9 * RATE_MULTIPLIER,
85+
timeUnit: '1s',
86+
preAllocatedVUs: 1000,
87+
maxVUs: 1000,
88+
},
89+
services_refresh: {
90+
executor: 'constant-arrival-rate',
91+
exec: 'servicesRefresh',
92+
duration: DURATION,
93+
rate: 9 * RATE_MULTIPLIER,
94+
timeUnit: '1s',
95+
preAllocatedVUs: 1000,
96+
maxVUs: 1000,
97+
},
98+
service_links_refresh: {
99+
executor: 'constant-arrival-rate',
100+
exec: 'serviceLinksRefresh',
101+
duration: DURATION,
102+
rate: 9 * RATE_MULTIPLIER,
103+
timeUnit: '1s',
104+
preAllocatedVUs: 1000,
105+
maxVUs: 1000,
106+
},
107+
},
108+
};
109+
110+
// Scenarios
111+
export async function opsHealthcheck(data) {
112+
http.get(`${CORE_BASE_URL}/ops/healthcheck`);
113+
}
114+
115+
export async function attest(data) {
116+
const validTrustedAttestationRequest = '{"attestation_request":"AA==","public_key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl7kXK1wf15V9HgkQhbMK2nfJGbudmdXNrX7MZjFm07z6eEjaQsuqMteQumLRwn+RxEcXKVaxBAE3RQTFL9XsZc2OtRKOU+oMIQep8tmPFMgh83BzjLs5O5HZf510geFJO6qRqc3UHJT3ACxE7IkmRx1JIKFKPzTrthHdb2+D7bdJBPsVbwk7y+a36f5jvELGGzMC89LAvd7JpOmGsCAj6jwiEAKmmLId9bfe0YeLuebl95VfSzrQVdz82oGGQKXuJgKZtc/Xp1omZ9spm+zzVFJzsimxDdGdnaWMnas43VoTE04JDt+pucJTTbftIvu05frwkbZh3sQ2yBu5gBP7YwIDAQAB","application_name":"uid2-operator","application_version":"5.27.10-3f25586306","components":{"uid2-attestation-api":"2.0.0-f968aec0e3","uid2-shared":"7.2.4-SNAPSHOT"}}';
117+
http.post(`${CORE_BASE_URL}/attest`, validTrustedAttestationRequest, AUTH_HEADERS);
118+
}
119+
120+
export async function clientsRefresh(data) {
121+
http.get(`${CORE_BASE_URL}/clients/refresh`, HEADERS);
122+
}
123+
124+
export async function keysetRefresh(data) {
125+
http.get(`${CORE_BASE_URL}/key/keyset/refresh`, HEADERS);
126+
}
127+
128+
export async function keysetKeysRefresh(data) {
129+
http.get(`${CORE_BASE_URL}/key/keyset-keys/refresh`, HEADERS);
130+
}
131+
132+
export async function saltRefresh(data) {
133+
http.get(`${CORE_BASE_URL}/salt/refresh`, HEADERS);
134+
}
135+
136+
export async function sitesRefresh(data) {
137+
http.get(`${CORE_BASE_URL}/sites/refresh`, HEADERS);
138+
}
139+
140+
export async function clientSideKeypairsRefresh(data) {
141+
http.get(`${CORE_BASE_URL}/client_side_keypairs/refresh`, HEADERS);
142+
}
143+
144+
export async function servicesRefresh(data) {
145+
http.get(`${CORE_BASE_URL}/services/refresh`, HEADERS);
146+
}
147+
148+
export async function serviceLinksRefresh(data) {
149+
http.get(`${CORE_BASE_URL}/service_links/refresh`, HEADERS);
150+
}

0 commit comments

Comments
 (0)