Closed m-restieri closed 4 years ago
Hi, and thank you for the report! 🙏🏼
Is 3000
the port on which your application is exposed when you run npm start
?
If not, please change the port to the one your application is exposed on. If it is, could you please paste the surrounding logs as well?
Thanks, Simme
Hi Simme,
Yes, 3000 is the correct port, but I'm not sure if the action could be messing with/changing the port?
Here is a screenshot of the surrounding logs (same message for all requests).
Could you please check the logs for the previous step as well? 😅
Yes, here is a screenshot.
It seems like something has changed in how actions work, as I can't get it to work anymore either. With that said, running against a local server is still possible, just not with the marketplace action:
name: Main Workflow
on: [push]
jobs:
build:
name: Run k6 test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Install packages
run: |
npm install
- name: Start server and run tests
run: |
npm start & npx wait-on http://localhost:3000
./k6 run test.js
I am now getting a syntax error for the workflow that you provided, even tho it appears to be valid yaml syntax.
I am now getting a syntax error for the workflow that you provided, even tho it appears to be valid yaml syntax.
My bad, the indentation is off:
name: Main Workflow
on: [push]
jobs:
build:
name: Run k6 test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Install packages
run: |
npm install
- name: Start server and run tests
run: |
npm start & npx wait-on http://localhost:3000
./k6 run test.js
Got it, it works now. Thanks! Here is the final workflow file for reference, had to add build.
name: k6 Load Tests
on: [push]
jobs:
build:
name: Run k6 test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Install packages
run: |
npm install
- name: Build
run: |
DEPLOYMENT=dev npm run build
- name: Start server and run tests
run: |
npm start & npx wait-on http://localhost:3000
./k6 run __tests__/k6-loadTest.ts
Hai I wanna ask something,
Here is my workflow:
# This workflow will run an end-to-end test with k6 scripts.
name: k6_end_to_end_test
on:
pull_request:
branches: ["testing"]
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install k6
run: |
curl https://github.com/loadimpact/k6/releases/download/v0.26.2/k6-v0.26.2-linux64.tar.gz -L | tar xvz --strip-components 1
- name: Spin up container to run e2e
run: docker-compose -f docker-compose.test.yml up -d --build
- name: Run k6 e2e test
run: ./k6 run testing/end_to_end_test.js
- name: Remove container
run: docker-compose -f docker-compose.test.yml down
The docker basically consist of my backend server. Docker step is already running well. When it comes to k6, turns out it outputs like:
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
time="2024-01-30T08:44:43Z" level=error msg="The moduleSpecifier \"testing/end_to_end_test.js\" couldn't be retrieved from the resolved url \"https://testing/end_to_end_test.js\". Error : \"Get https://testing/end_to_end_test.js: dial tcp: lookup testing on 12[7](https://github.com/SC-Starcapital/sun-rec/actions/runs/7708459356/job/21007580014?pr=38#step:5:8).0.0.53:53: server misbehaving\""
Instead of running the script located on testing/end_to_end_test.js
, it hits https://testing/end_to_end_test.js:
. I have no idea what's going on.
Please help anyone @m-restieri @simskij
Hi @starRMS. it isn't really a good idea to ask questions in closed issues, espeically ones from years ago. In most cases people will just not see this at all.
You are very likely not mounting the script in question inside the job so the file ./testing/end_to_end_test.js
is not accessible and k6 (for historical reasons) tried to interpret everything that isn't working as a url if it could. This is no longer supported - here is the issue with some more info.
I would also recommend not using k6 v0.26.2 given that it is close to 4 years old.
If you have more questions I do recommend our community forums
Hi @starRMS. it isn't really a good idea to ask questions in closed issues, espeically ones from years ago. In most cases people will just not see this at all.
You are very likely not mounting the script in question inside the job so the file
./testing/end_to_end_test.js
is not accessible and k6 (for historical reasons) tried to interpret everything that isn't working as a url if it could. This is no longer supported - here is the issue with some more info.I would also recommend not using k6 v0.26.2 given that it is close to 4 years old.
If you have more questions I do recommend our community forums
You're absolutely right.
I wasn't paying attention the version of the k6 on this issue.
Thanks for the feedback, learnt a lot from this. Have a good day.
I am trying to create a github action which uses k6 to test on a localhost server, but the server refuses to connect.
Environment
Expected Behavior
Create a github action which performs load testing on each push on a local instance (port 3000).
Actual Behavior
In the github action when trying to run the tests, all the requests refuse to connect to the server, despite working when locally tested.
Steps to Reproduce the Problem
The test script is a very basic typescript file that just calls http.get on a localhost url with some thresholds for performance. Here is the .yml file that I have been using for the github action:
Error message which appears at all of the requests:
time="2020-07-06T20:12:08Z" level=warning msg="Request Failed" error="Get http://127.0.0.1:3000/ci-test: dial tcp 127.0.0.1:3000: connect: connection refused"