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

is there a way we can allow for deliberate snapshot matching? #197

Open
lukfor opened this issue Feb 2, 2024 · 4 comments
Open

is there a way we can allow for deliberate snapshot matching? #197

lukfor opened this issue Feb 2, 2024 · 4 comments

Comments

@lukfor
Copy link
Collaborator

lukfor commented Feb 2, 2024

          @lukfor, is there a way we can allow for deliberate snapshot matching?

I've actually found it very useful to be able to have multiple tests refer to the same snapshot id. When testing a pipeline's logic, there will be times when skipping a process will impact files downstream of the process but not upstream. In this situation, it's been quite useful to group files that are expected to be unchanged into one snapshot id (which can be used across multiple tests) and those you expect to change. E.g.

{ assert snapshot(
                    path("$outputDir/cat/SAMPLE3_SE.merged.fastq.gz"),
                    path("$outputDir/pipeline_info/samplesheet.valid.csv")
                    ).match("common_files") 
                }

With the new modification, if I now want to check that the files I expect to be unchanged are truly unchanged across multiple test, I would have to manually compare md5s in the snapshot.

Originally posted by @RHReynolds in #188 (comment)

@RHReynolds
Copy link

Thanks for opening this as an issue @lukfor! :)

@lukfor
Copy link
Collaborator Author

lukfor commented Feb 3, 2024

I see. We could extend the mechanism so that ids starting, for example, with '!' could be used multiple times.

E.g.:

assert snapshot(...).match("!common_files") 
                

@RHReynolds
Copy link

Thanks for being so responsive on this! That sounds like a sensible solution to me.

@edmundmiller
Copy link
Contributor

edmundmiller commented Nov 26, 2024

Hey, @lukfor. I thought this was the opposite because I ran into it while using "versions" in nf-core/modules, and I can't find an example of anyone successfully doing it in modules. I've found examples of the opposite.

https://github.com/nf-core/modules/blob/b59962e477df7a20861ff7d982a16459a8557a65/modules/nf-core/learnmsa/align/tests/main.nf.test

I just searched for "match versions" in the repo.

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

No branches or pull requests

3 participants