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

Better testing of large strings / large amount of output #2364

Open
Tracked by #2512
AustinAbro321 opened this issue Mar 7, 2024 · 1 comment
Open
Tracked by #2512

Better testing of large strings / large amount of output #2364

AustinAbro321 opened this issue Mar 7, 2024 · 1 comment
Assignees

Comments

@AustinAbro321
Copy link
Contributor

AustinAbro321 commented Mar 7, 2024

Describe what should be investigated or refactored

Usually when testing a large output like on zarf dev find-images we only check a few strings such as require.contains("string-we-hope-to-find"), however this comes with some disadvantages. That string could appear more than once when we don't want it to, we could also get extra output we don't expect and aren't testing.

One solution we've tried is to create a text file of what we are looking for and ensure standard output contains the contents of the text file. This can be a brittle approach though and when something changes it can be hard to know exactly what changed.

In other languages I've used the approval tests framework https://github.com/approvals/go-approval-tests, which helped this process be more convenient, though in go it doesn't seem very popular or maintained. I do know the creator of approval tests, so I could pair with him to update the package if we wanted to

@schristoff-du
Copy link
Contributor

Let's start to implement this with golden files and use test/testing directories

@Noxsios Noxsios assigned Noxsios and unassigned Noxsios May 20, 2024
@schristoff-du schristoff-du self-assigned this May 21, 2024
@salaxander salaxander added this to Zarf Jul 22, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Zarf Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

4 participants