Bitbucket Pipeline Can't Connect to Localhost for k6 Tests on Juice Shop

Mohamed Saadi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2024

Hello all,

I'm relatively new to Bitbucket Pipelines and am facing an issue where my pipeline fails to connect to a service running on localhost:3000 during a test phase. I've set up a pipeline to automate testing on the OWASP Juice Shop application, running it in one step and then attempting to run k6 tests against it in the next.

 

My bitbucket-pipelines.yml looks like this:

pipelines:
default:
- step:
name: "Run Juice Shop"
image: docker:stable
services:
- docker
script:
- docker pull bkimminich/juice-shop
- docker run --rm -p 3000:3000 bkimminich/juice-shop
- sleep 20 # Allows time for Juice Shop to start
- step:
name: "Run k6 Tests"
image: grafana/k6:master-with-browser
script:
- k6 run k6/Basictest.js

The Juice Shop application starts successfully and is accessible on localhost:3000. However, when it comes to running the k6 tests in the second step, the tests fail because they cannot connect to the Juice Shop running on localhost:3000. I suspect the issue lies in how networking is handled between the steps or maybe a misconfiguration on my part.

 

Is there a specific approach to ensure services started in one step are accessible in subsequent steps, especially for localhost connections?

 

I'm eager to learn and fix this issue, so any insights, advice, or resources you could share would be highly appreciated!

Thank you for your time and help!

1 answer

0 votes
Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2024

Hello, Good day. Please move this query to Bitbucket community discussions : https://community.atlassian.com/t5/Bitbucket-questions/qa-p/bitbucket-questions

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events