[tests] Don't compare mocked test data as lists but as sets #763
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
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.The text was updated successfully, but these errors were encountered: