postgres-operator/pkg
Jonathan Juares Beber fddaf0fb73 Change error computation on JSON Unmarshal and create subtests on table test scenarios (#801)
* Change error computation on JSON Unmarshall

The [Unmarshall function][1] 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 it
returns `json: cannot unmarshal number into Go struct field
PostgresSpec.spec.teamId of type string`. The new version includes more
details of the whole structure being unmarshelled.

This commit introduces the same error but one level deeper on the JSON
structure. It creates consistency across different Go versions.

[1]: https://godoc.org/encoding/json#Unmarshal

* 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 an error during test execution with
subtests:

```
--- FAIL: TestUnmarshalMaintenanceWindow (0.00s)
    --- FAIL: TestUnmarshalMaintenanceWindow/expect_error_as_'From'_is_later_than_'To' (0.00s)
```

It included a `about` field on test scenarios describing the test
purpose and/or it expected output. When a description was provided with
comments it was moved to the about field.
2020-01-27 14:43:32 +01:00
..
apis/acid.zalan.do Change error computation on JSON Unmarshal and create subtests on table test scenarios (#801) 2020-01-27 14:43:32 +01:00
apiserver reflect change in github url (#496) 2019-02-25 11:26:55 +01:00
cluster standby clusters can only have 1 pod for now (#797) 2020-01-16 10:47:34 +01:00
controller Enforce minimum cpu and memory limits (#731) 2019-12-12 16:43:55 +01:00
generated update copyright in generated code (#779) 2020-01-02 17:34:49 +01:00
spec Fix golint failures 2019-01-08 13:04:48 +01:00
util bump operator v1.3.0 with Spilo 12 image (#770) 2019-12-17 17:13:56 +01:00