Change error computation on JSON Unmarshal and create subtests on table test scenarios #801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change error computation on JSON Unmarshall
The Unmarshall function on the encoding/JSON default library returns
different errors for different go versions. On Go 1.12, the version used
currently on the CI system it returns
json: cannot unmarshal number into Go struct field PostgresSpec.teamId of type string
. On Go 1.13.5 itreturns
json: cannot unmarshal number into Go struct field PostgresSpec.spec.teamId of type string
. The new version includes moredetails of the whole structure being unmarshalled.
This commit introduces the same error but one level deeper on the JSON
structure. It creates consistency across different Go versions.
Create subtests on table test scenarios
The Run method of T allows defining subtests creating hierarchical tests.
It provides better visibility of tests in case of failure. More
details on https://golang.org/pkg/testing/.
This commit converts each test scenario on
pkg/apis/acid.zalan.do/v1/util_test.go to subtests, providing a better
visibility and the debugging environment when working with tests. The
following code snippet shows a error during test execution with
subtests:
It included a
about
field on test scenarios describing the testpurpose and/or it expected output. When a description was provided with
comments it was moved to the about field.