Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix handleSummary do not check if directory exists #3464

Closed
wants to merge 2 commits into from

Conversation

jsolana
Copy link

@jsolana jsolana commented Nov 21, 2023

What?

Fix create the parent directories if they don't exist yet described in #3084 creating the parent directories if they don't exist yet, like mkdir -p would do.

Why?

k6 run will fails in the after-stage when creating summary if the output directories don't exist previously

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

Closes #3084

Sorry, something went wrong.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Javier Solana Huertas seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot requested review from mstoykov and oleiade November 21, 2023 22:51
@oleiade
Copy link
Member

oleiade commented Nov 22, 2023

Hey @jsolana 👋🏻

Thanks for your contribution 🤝

To be fair and transparent with you, I'm torn about doing this. My reasoning is the following:

  1. On one hand, I don't think it's k6's responsibility to manage the filesystem and ensure a directory exists. Most common tools I can think of will produce an error if you configure them to write their artifacts in a custom folder that doesn't exist (instead of creating it themselves).
  2. On the other hand, I want to acknowledge that the summary we're producing is a byproduct of a k6 run, and it could be argued that if we allow to specify a destination that contains a path, it could make sense to allow k6 to make sure the destination exists. Also, k6 itself doesn't let you create directories from your scripts which adds to the argument.

Overall, I'm rather against merging this as per ☝🏻 and as there is an easy workaround: either manually ensuring your destination folder exists, or scripting it as part of the testing environment.

@olegbespalov olegbespalov added the awaiting user waiting for user to respond label Nov 23, 2023
@oleiade oleiade closed this Nov 27, 2023
@jsolana
Copy link
Author

jsolana commented Nov 27, 2023

Ey @oleiade, sorry for the delay!

I was out cause a little break (and celebrating my birthday!)

My main concern is, somethings you are running costly tests and with no previous control, we are failing saving the information in the last moment and the user needs to run the test again.

Im fine with your point of view, maybe is enough with a clarification in the documentation instead to try an automatic- under-the-hood solution?

Just to understand your whole message, when you say:

either manually ensuring your destination folder exists, or scripting it as part of the testing environment.

What do you mean?

Thanks!

PST: I'll try to start collaborating with other good first issue :D

@oleiade
Copy link
Member

oleiade commented Nov 29, 2023

Happy birthday @jsolana 🍰 🎂 🎁 🍾 🎉

What do you mean?

What I had in mind was that you would chain the k6 run command with an mkdir -p statement to make sure the destination exists:

mkdir -p /some/folder/holding/data && k6 run script.js

Which could also be integrated as part of a CI job, and so on.

Please keep in mind that my understanding of the issue you're trying to solve might be limited, though, and that without more thorough and concrete examples, I might also be missing the point 👍🏻

Please feel free to go ahead with first good issue issues. We're very keen on receiving contributions, and we'd be happy to provide the support you need. My recommendation would be that you start by looking at the issue, and the related code, and start by asking any questions you might have as a result, before opening a PR 🙇🏻

I hope that's helpful, and happy birthday again!

@jsolana
Copy link
Author

jsolana commented Nov 29, 2023

Thanks! and thanks a lot for the clarifications and tips (make total sense start talking about instead to do the PR directly :D )

I assume, more or less the solution was defined cause this comment from @imiric

In the case of this:

mkdir -p /some/folder/holding/data && k6 run script.js

Do you think make sense to modify the documentation to provide any kind of awareness?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting user waiting for user to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handleSummary do not check if directory exists
4 participants