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

[tests] Don't compare mocked test data as lists but as sets #763

Open
eskultety opened this issue Dec 5, 2024 · 0 comments
Open

[tests] Don't compare mocked test data as lists but as sets #763

eskultety opened this issue Dec 5, 2024 · 0 comments
Labels
gomod Pull requests/issues related to the gomod handling module my first issue Good for newcomers tests Issue regarding a test suite problem
Milestone

Comments

@eskultety
Copy link
Member

Go is one of the backends for which we have real mocked data generated by legitimate Go toolchains. We then parse the saved JSON output from various go commands and run it through our core logic comparing the results with expected results on the data structure level. That's all fine, except when we compare non-scalar values as sequences which generates a lot of noise and false positives because we don't control how newer versions of Go used to generate the mocked data sets are ordered, but we expect a certain ordering in the test result data sets. Ordering is not important at all when it comes to comparing e.g. ParsedModule sequences, only equality is.
Therefore, we need to make all data structures that end up in a sequence hashable, so that whenever ordering is not important, we can use plain set comparisons in our asserts. This will reduce the need to shuffle existing entries in the mocked data sets when re-generating the mocked data and create less noise in the resulting diff.

@eskultety eskultety added my first issue Good for newcomers gomod Pull requests/issues related to the gomod handling module labels Dec 5, 2024
@eskultety eskultety added this to the Refactoring milestone Dec 5, 2024
@eskultety eskultety changed the title [tests] [gomod] Don't compare mocked test data as lists but as sets [tests] Don't compare mocked test data as lists but as sets Dec 5, 2024
@eskultety eskultety added the tests Issue regarding a test suite problem label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gomod Pull requests/issues related to the gomod handling module my first issue Good for newcomers tests Issue regarding a test suite problem
Projects
None yet
Development

No branches or pull requests

1 participant