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.