-
Notifications
You must be signed in to change notification settings - Fork 690
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/assert: Better protobuf diffs by aliasing testify/assert (#2787
) This change replaces the current `github.com/google/go-cmp/cmp` based internal `assert.Equal` with an aliased version of testify `assert.Equal`. If we need other assertions, we'll need to add them one by one. This allows better output for non-protobuf tests. However, it does mean that now Error message text is being checked - there were about four places I needed to fix as a result. Unfortunately, testify does not have support for unmarshaling protobufs, so I needed to move to a new `assert.EqualProto` function that uses `protocmp` to compare the two protobufs. This also exposed another issue that the old `assert.Equal` was working around: the Envoy DiscoveryResponse proto has version and nonce fields that can change in ways that make tests flaky. However, it turns out that all the tests in `featuretests` that needed the workaround only change the `Resources` field. So I've updated the featuretests infrastructure to have the `Equals` method on the Response struct for testing only compare that `Resources` field. This should probably be replaced with `EqualResources` and `NoResources` for the normal and empty case respectively, but this PR is big enough for now. The `internal/assert` library will now behave the same as the testify `assert`: failures will produce t.Error() output, but will not be fatal. The feature tests have been updated so that the `Equals()` method on the testing Response struct is still fatal; this replicates the existing behavior. Updates #2786 for now, until a second PR that will change the names as above. Signed-off-by: Nick Young <ynick@vmware.com>
- Loading branch information
Nick Young
authored
Aug 13, 2020
1 parent
6c26cea
commit 057fdc0
Showing
19 changed files
with
83 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.