Update project structure while using VolumeClaim

Hello everybody,

I’ve started with activity to migrate k6 tool to Kubernetes cluster as k6-operator. My project is bigger than 1MB so I decided to add test scripts as VolumeClaim.
According to this doc i see that structure is have test.js file with your tests under /test/ folder.

My actual project structure is following:
|-- common folder with common functions
|-- team1 folder
| |-- TestSuite1.js
| |-- TestSuite2.js
|-- team2 folder
| |-- TestSuite1.js
| |-- TestSuite2.js
etc…

TestSuite.js - this file contains:

  • variables
  • test setup
  • tags
  • thresholds
  • calling setup functions for obtaining token
  • default function with all requests under groups
  • handleSummary function

I have to update my existing project according to structure while using VolumeClaim:
|-- test
| |-- team1
| | |-- Requests1.js
| | |-- Requests2.js
| |-- team2
| | |-- Requests1.js
| | |-- Requests2.js
| |-- TestSuite1.js
| |-- TestSuite2.js
etc…

Now i want to have defined all requests in Request.js.
My TestSuite.js should contains following:

  • variables
  • test setup
  • tags
  • thresholds
  • calling setup functions for obtaining token
  • under default function call functions from Request.js which will be organized in groups
  • handleSummary function

I would like to consult with you if this is good manner to update my project structure or not and if it will work as expected :slight_smile:

Thank you in advance :slight_smile:

Hi @matomajzlik, welcome to the community forum :wave:

I’m not fully clear on why you “have to update” your project structure, but you don’t need to create a /test folder. For the volumeClaim usage in context of k6-operator, there are no restrictions on the folder structure: so long as all necessary (dependencies) files for the script are present somewhere in the volume, that is sufficient. Of course, TestRun CR should reference correct relative path to the script, to “know” what to execute. As for /test, it is hard-coded as the mountPath: you can use it to check manually if all is OK with your volume setup.

Hope that helps! Let me know if there are any other questions.

Hello @olhayevtushenko ,

thank you very much for your answer. :slight_smile:
When i added relative path to “file” under “volumeClaim” in YAML file, it finished successfully. :slight_smile:

1 Like