Hello team,
I am trying to run k6-browser test on a Jenkins instance which is in docker container.
The test is failing on starting chrome step with error: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory
Jenkins logs
npm start
@epricer-ng/epricer-load-test@1.0.0 start > webpack
assets by path fixtures/ 28.8 KiB asset fixtures/cfr/cfr1.cfr 7.03 KiB [emitted] [from: assets/fixtures/cfr/cfr1.cfr] [copied] asset fixtures/cfr/cfr2.cfr 7.03 KiB [emitted] [from: assets/fixtures/cfr/cfr2.cfr] [copied] asset fixtures/cfr/cfr3.cfr 7.03 KiB [emitted] [from: assets/fixtures/cfr/cfr3.cfr] [copied] asset fixtures/cfr/cfr4.cfr 7.03 KiB [emitted] [from: assets/fixtures/cfr/cfr4.cfr] [copied] asset fixtures/env.ts 680 bytes [emitted] [from: assets/fixtures/env.ts] [copied] assets by path *.json 7.28 KiB asset thresholdValues.json 5.02 KiB [emitted] [from: assets/thresholdValues.json] [copied] asset config.json 1.91 KiB [emitted] [from: assets/config.json] [copied] asset users.json 348 bytes [emitted] [from: assets/users.json] [copied] asset main.js 210 KiB [emitted] (name: main) 1 related asset orphan modules 172 KiB [orphan] 38 modules runtime modules 937 bytes 4 modules built modules 198 KiB [built] ./src/main.ts + 38 modules 173 KiB [not cacheable] [built] [code generated] ./node_modules/regenerator-runtime/runtime.js 24.7 KiB [built] [code generated] webpack 5.94.0 compiled successfully in 3553 ms
[Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Load Test) [Pipeline] script [Pipeline]
{
[Pipeline] buildName New run name is ā#1136-LAB2:ui-smoke test:BPNextā [Pipeline] withCredentials Masking supported pattern matches of $DYNATRACE_APITOKEN [Pipeline] { [Pipeline] sh + mkdir reports [Pipeline] sh + mkdir screenshots [Pipeline] echo Running K6 with load testā¦ [Pipeline] shk6 run -e exec=ui_smoke_test -e app=BPNext -e host=LAB2 -e test=bpUISanity -e vus=1 -e iteration=1 -e maxDuration=10m dist/main.js --out dashboard=port=-1&period=1s&export=reports/dashReport.html --out json=result.json
/\ |ā¾ā¾| /ā¾ā¾/ /ā¾ā¾/ /\ / \ | |/ / / / / \/ \ | ( / ā¾ā¾\
/ \ | |\ \ | (ā¾) |
/ __________ \ |__| _\ ____/ .iotime=ā2024-09-24T16:05:41Zā level=info msg=ā{"bpUISanity":{"executor":"per-vu-iterations","vus":"1","iterations":"1","maxDuration":"10m","options":{"browser":{"type":"chromium"}},"exec":"bpUISanity"}}ā source=console
execution: local
script: dist/main.js
output: dashboard, json (result.json)scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): bpUISanity: 1 iterations for each of 1 VUs (maxDuration: 10m0s, exec: bpUISanity, gracefulStop: 30s)
time=ā2024-09-24T16:05:41Zā level=error msg=āprocess with PID 1664 unexpectedly ended: signal: abortedā category=browser elapsed=ā0 msā source=browser
time=ā2024-09-24T16:05:41Zā level=warning msg=āThe test run was short, report generation was skipped (not enough data)ā
time=ā2024-09-24T16:05:42Zā level=info msg=ā[k6-reporter v2.3.0] Generating HTML summary reportā source=console
data_receivedā¦: 0 B 0 B/s
data_sentā¦: 0 B 0 B/s
iteration_durationā¦: avg=107.68Āµs min=107.68Āµs med=107.68Āµs max=107.68Āµs p(90)=107.68Āµs p(95)=107.68Āµs
iterationsā¦: 1 13.588872/s
running (00m00.1s), 0/1 VUs, 0 complete and 1 interrupted iterations
bpUISanity ā [ 100% ] 1 VUs 00m00.1s/10m0s 1/1 iters, 1 per VU
time=ā2024-09-24T16:05:42Zā level=error msg="error building browser on IterStart: launching browser: open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) at bpUISanity (webpack://@epricer-ng/epricer-load-test/./src/scenarios/bp/bpUISanity.ts:4:7(0))"
Here is my Dockerfile
Stage 1: Fetch base image with go
FROM JFrog
Install required packages
RUN apt-get update &&
apt-get install -y git npm sudo &&
useradd -m go &&
adduser go sudo &&
echo ā%sudo ALL=(ALL) NOPASSWD:ALLā >> /etc/sudoersWORKDIR /app
Install xk6
RUN go install go.k6.io/xk6/cmd/xk6@latest
Stage 2: Build the custom k6 image with extensions
RUN xk6 build v0.53.0
āwith GitHub - grafana/xk6-dashboard: A k6 extension that makes k6 metrics available on a web-based dashboard.
āoutput /usr/local/bin/k6
Here is chrome installation stage in jenkins:
stage (āInstall Chromeā) {
when {
expression { params.executor == āui-smoke testā || params.exector == āui-load testā }
}
steps {
sh āsudo apt-get --quiet -y install wget zipā
// Install chrome dependencies
sh āsudo apt-get --quiet -y install fonts-liberation libappindicator3-1 xdg-utils libcurl4 libu2f-udev libasound2 libnspr4 libnss3 libvulkan1ā
// Install chrome
sh āsudo wget --quiet --output-document /usr/src/google-chrome.deb āhttps://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debāāsh 'sudo dpkg -i /usr/src/google-chrome.deb ;' sh 'sudo apt-get --quiet -y -f install' sh 'sudo rm -f /usr/src/google-chrome.deb' } }
Same test is working perfectly fine on my local windows.