The moduleSpecifier \”/tests/load.js\” couldn’t be found on local disk

29 views Asked by At

Need help with the issue on gtilab-ci pipeline.

my docker-compose file looks like this:

version: '3.8'

networks:
  k6:
  grafana:

services:
  influxdb:
    image: influxdb:1.8
    networks:
      - k6
      - grafana
    ports:
      - "8086:8086"
    environment:
      - INFLUXDB_DB=k61

  grafana:
    image: grafana/grafana:9.3.8
    networks:
      - grafana
    ports:
      - "3000:3000"
    environment:
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_BASIC_ENABLED=false
    volumes:
      - ./grafana:/etc/grafana/provisioning/

  k6:
    image: grafana/k6:latest
    networks:
      - k6
    ports:
      - "6565:6565"
    environment:
      - K6_OUT=influxdb=http://influxdb:8086/k6
    volumes:
      - ./resources:/jmanager
      - ./resources:/resources
      - ./tests:/tests
      - ./utils:/utils

my gitlab-ci.yaml file looks like this:

stages:
  - test

load_test:
  stage: test
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker-compose --file=k6/compose.yaml up --build -d
    - docker-compose --file=k6/compose.yaml run k6 run /tests/load.js
    - docker-compose --file=k6/compose.yaml down --remove-orphans
  tags:
    - eks-tooling-generic

When it trying to execute this command “docker-compose --file=k6/compose.yaml run k6 run /tests/load.js” it shows the error that file cannot be found.

$ docker-compose --file=k6/compose.yaml run k6 run /tests/load.js

79time=“2024-03-25T10:42:02Z” level=error msg="The moduleSpecifier "/tests/load.js" couldn’t be found on local disk. Make sure that you’ve specified the right path to the file.

The root path to file is "k6/tests/load.js"

Could someone help me to solve this error? Why it cannot see my load.js file? Locally everything works as expected.

The root path to file is "k6/tests/load.js".
Root path to compose.yaml is "k6/compose.yaml".
Volumes: "- ./tests:/tests". Locally, I run my tests like this: "docker-compose --file=k6/compose.yaml run k6 run /tests/load.js"

1

There are 1 answers

5
Bent On

It looks like you are using an absolute path: /tests/load.js Is that intended?