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 junit report directory structure too (mkdir -p) #2842

Closed
2 tasks
OverkillGuy opened this issue May 27, 2024 · 4 comments · Fixed by #2862
Closed
2 tasks

Generate junit report directory structure too (mkdir -p) #2842

OverkillGuy opened this issue May 27, 2024 · 4 comments · Fixed by #2862
Assignees
Labels
enhancement New feature or request topic: reports
Milestone

Comments

@OverkillGuy
Copy link

OverkillGuy commented May 27, 2024

Problem to solve

Generating folder structure (mkdir -p) when using --report-junit flag. Identical feature to #2531, but for --report-junit after --report-html.

My previous feature request on report-html, linked, missed that the same behaviour would happen with junit reports.

As I just now upgraded to v4.3.0 with the mkdir -p feature, I "uncovered" this issue/feature request opportunity.

Proposal

Like for #2531, use create_dir_all to create all folders as needed.

Additional context and resources

Reproducing the issue

  • Create a hurl file
  • Run hurl --test --report-junit non-existent-folder/new_junit_file.xml
  • Observe issue: error: Failed to produce JUnit report: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  • Run mkdir -p non-existent-folder/
  • Rerun same command: hurl --test --report-junit non-existent-folder/new_junit_file.xml
  • Now passes

Tracing the solution

Error message triggered here:

message: format!("Failed to produce Junit report: {e:?}"),

Seems the file creation code of:

let file = match File::create(filename) {

Is missing call to fs::create_dir_all?

The solution of #2531 is likely just as good

Tasks to complete

  • Consensus on "do we want this?" as a tool/community (Junit is special)
  • Identify a proper "fix" (previous request was just changing create_dir to create_dir_all, this may need to introduce a whole folder creation logic)
@OverkillGuy OverkillGuy added the enhancement New feature or request label May 27, 2024
@jcamiel jcamiel added this to the 5.0.0 milestone May 28, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented May 28, 2024

Thanks for the detailed issue @OverkillGuy the PR has been merged on master,

@OverkillGuy
Copy link
Author

Thank you!

However the PR seems to be about TAP, not junit files? Is the code path similar somehow, or is this a similar-but-different feature implementation?
Appreciated either way

@jcamiel
Copy link
Collaborator

jcamiel commented May 29, 2024

Ah ah good catch, sorry for this @OverkillGuy you're totally right 🙃. I'll update the JUnit code with the same improvement!

@jcamiel
Copy link
Collaborator

jcamiel commented May 31, 2024

Hi @OverkillGuy this should be OK THIS TIME ☺️!

@jcamiel jcamiel self-assigned this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic: reports
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants