Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Jan 31, 2024
1 parent d732045 commit e122c6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/coreutils/techutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,20 @@ func TestMapFilesToRelevantWorkingDirectories(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
detectedWd, detectedExcluded := mapFilesToRelevantWorkingDirectories(test.paths, test.requestedDescriptors)
// Assert working directories
expectedKeys := maps.Keys(test.expectedWorkingDir)
actualKeys := maps.Keys(detectedWd)
assert.ElementsMatch(t, expectedKeys, actualKeys, "expected: %s, actual: %s", expectedKeys, actualKeys)
for key, value := range test.expectedWorkingDir {
assert.ElementsMatch(t, value, detectedWd[key], "expected: %s, actual: %s", value, detectedWd[key])
}
assert.True(t, reflect.DeepEqual(test.expectedExcluded, detectedExcluded), "expected: %s, actual: %s", test.expectedExcluded, detectedExcluded)
// Assert excluded
expectedKeys = maps.Keys(test.expectedExcluded)
actualKeys = maps.Keys(detectedExcluded)
assert.ElementsMatch(t, expectedKeys, actualKeys, "expected: %s, actual: %s", expectedKeys, actualKeys)
for key, value := range test.expectedExcluded {
assert.ElementsMatch(t, value, detectedExcluded[key], "expected: %s, actual: %s", value, detectedExcluded[key])
}
})
}
}
Expand Down

0 comments on commit e122c6d

Please sign in to comment.