Skip to content

Commit

Permalink
Merge pull request #916 from SSWConsulting/k6-fix
Browse files Browse the repository at this point in the history
🐛 Mobile | Fix issue with k6 not running in Docker
  • Loading branch information
zacharykeeping authored Sep 13, 2024
2 parents 1b38d34 + 54aa41a commit 4f814a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ RUN wget -q https://dl.k6.io/key.gpg -O- | apt-key add -
RUN echo "deb https://dl.k6.io/deb stable main" | tee -a /etc/apt/sources.list
RUN apt-get update && apt-get install -y k6

# copy k6 scripts
COPY k6-scripts /home/lhci/app/k6-scripts

# main nodejs app
COPY --from=nodeBuilder /usr/src/app /home/lhci/app

Expand Down
4 changes: 2 additions & 2 deletions docker/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ exports.runK6LoadTest = (url, writeLog) => {
}

/**
* parse Lighthouse Report
* @param {string} folder - lhr file
* parse k6 Report
* @param {string} folder - k6 file
* @param {func} writeLog - logging method
*/
exports.readK6Results = async (folder, writeLog) => {
Expand Down
10 changes: 6 additions & 4 deletions ui/src/containers/K6Report.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
let promise = getBuildDetails(currentRoute.namedParams.id);
let userNotLoginToast;
const reportUrl = `${CONSTS.BlobURL}/k6report/${currentRoute.namedParams.id}.json`;
const download = () => {
window.location.href = `${CONSTS.BlobURL}/atr/${currentRoute.namedParams.run}.json`;
window.location.href = reportUrl;
};
let k6Result = {};
const getK6Result = async (path) => {
await fetch(`${CONSTS.BlobURL}/k6report/${path}.json`)
const getK6Result = async () => {
await fetch(reportUrl)
.then((x) => x.json())
.then((res) => {
k6Result = res;
});
return k6Result;
};
let getK6Data = getK6Result(currentRoute.namedParams.id);
let getK6Data = getK6Result();
</script>

<div class="container mx-auto">
Expand Down

0 comments on commit 4f814a3

Please sign in to comment.