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

Function to recursively check all detected files for a specific string #23

Open
jfy133 opened this issue Oct 11, 2024 · 2 comments
Open
Assignees

Comments

@jfy133
Copy link
Member

jfy133 commented Oct 11, 2024

Currently there are two helper methods for checking output files:

  • Find all files with a pattern and generate an md5 (when contents stable between tests)
  • Find all files with a pattern and check existence by file name (when contents are unstable between tests)

While the of unstability fallback is good e.g. binary files, it's not as good as checking inside a file for consistent contents (E.g. when maybe it's only a single timestamp inside the file is unstable).

An intermediate check is to check for certain strings, e.g. maybe 'SUCCESSFUL RUN' at the end of a log.

It would be nice to have a function that does the same as the two existing methods, but with the string checking functionality.

@jfy133 jfy133 changed the title Function to recursively check all files with a suffix for a specific string Function to recursively check all detected files for a specific string Oct 11, 2024
@tom-seqera
Copy link

For simple cases, I think this can actually be done without any new functions using groovy to iterate the files returned by the existing getAllFilesFromDir and the existing nf-test file support:

then {
  def files = getAllFilesFromDir(...)
  files.each { file ->
    assert file.text.contains('SUCCESSFUL RUN')
  }
}

@jfy133
Copy link
Member Author

jfy133 commented Oct 30, 2024

@TCLamnidis Tom wrote a load of code, and then deleted it because apparently a whole separate function might be overkill... maybe you can try the above with the eager tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

2 participants