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

Generate html report directory structure (mkdir -p) #2531

Closed
5 tasks done
OverkillGuy opened this issue Mar 15, 2024 · 2 comments
Closed
5 tasks done

Generate html report directory structure (mkdir -p) #2531

OverkillGuy opened this issue Mar 15, 2024 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@OverkillGuy
Copy link

OverkillGuy commented Mar 15, 2024

Problem to solve

Generating test results in CI, the pattern I'm used to is a cross-tool test_results/ folder, in which we get a junit/ subfolder for junit-ish XML, a coverage/ folder for all coverage-related matters, and now a hurl/ subfolder for all hurl's output, mostly HTML. This looks like this:

test_results
├── coverage
│   ├── coverage.html
│   └── coverage.xml
├── hurl
│   └── index.html
└── junit
    ├── hurl_end2end.xml
    └── unit_results.xml

Note that the test_results/ folder doesn't exist in repo, it's generated by the first command that runs.
In CI during integration tests, that's hurl during the HTML report, but instead I get:

error: HTML dir test_results/hurl can not be created

Because I'm missing test_results/ root.
Note of course I could just create a .gitkeep empty file in that folder to keep it created, but I feel it's common to expect testing tools to be able to create result folders?

Proposal

Suggest enabling report-path creation like mkdir -p would, when given a report path that has missing parents, instead of crashing.

I'd personally expect this behaviour to be the default, but it's possibly surprising people, so maybe expose it as --mkdir-report flag if it's deemed unsafe by default.

Additional context and resources

Change in code might be as simple as changing this:

match std::fs::create_dir(path) {

-             match std::fs::create_dir(path) {
+             match std::fs::create_dir_all(path) {

Tasks to complete

  • Confirm we want this behaviour
  • Determine if there are more code paths affected
  • Determine if we need a flag for this instead of defaulting to it
  • Do the change
  • Testing to confirm no threading surprise etc
@OverkillGuy OverkillGuy added the enhancement New feature or request label Mar 15, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented Mar 16, 2024

Hi @OverkillGuy

Thank you for you detailed issue. It seems reasonable to me to create any intermediate subdirectory, it should be the default. I don't see any problem to implement it (I will check with the others maintainers),

Thanks!

@jcamiel jcamiel added this to the 4.3.0 milestone Mar 17, 2024
@jcamiel jcamiel linked a pull request Mar 19, 2024 that will close this issue
@jcamiel
Copy link
Collaborator

jcamiel commented Mar 19, 2024

Hi @OverkillGuy

This should be fixed now by #2555, will be available in Hurl 4.3.0.

Thanks for the report,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants