I tried to address this TODO today, but found that I kind of prefer how our
implementation works. I've found from time to time while writing tests that
I was accidentally wrapping my errors with the wrong context (i.e. message),
which is not something the cmpopts variant tests for.
Signed-off-by: Nic Cope <negz@rk0n.org>
Updates all core/v1alpha1 imports to the common/v1, which is the new
home of these embedded API types.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
There's _a lot_ going on in this commit. I've updated all resources to use the
embedded ResourceSpec, ResourceStatus, ResourceClaimSpec, etc structs and added
methods to ensure they satisfy the Resource and Claim interfaces.
I've also updated all controllers to suit. I've tried my best to limit the scope
of these changes to switching all controllers and their tests to:
* Use the new ConditionedStatus
* Use their WriteConnectionSecretTo field instead of generating a secret name
* Use the new ProviderReference field (which supports referencing Providers in
a different namespace)
I also updated many tests to use the '-want, +got' style annotation. This came
into scope mostly for my own sanity, as it allows me to read all test output the
same way when updating tests across many packages.
Signed-off-by: Nic Cope <negz@rk0n.org>
In all cases these updates address the fact that go-cmp requires the caller to
specify explicitly how it should handle unexported fields; cmp.Diff will
panic if it encounters an unexpected unexported field.
In many cases we encounter unexported fields while comparing errors types from
github.com/pkg/error. I've added an EquateErrors() comparer that maintains the
error comparison semantics of https://github.com/go-test/deep.
In most other cases I've also attempted to maintain the comparison semantics of
https://github.com/go-test/deep, which is to ignore unexported fields. In cases
where the test appeared to intend to compare the unexported fields of a type
under our control, and where comparing those unexported fields did not break the
test, I updated the test to compare unexported fields. In cases where the test
appeared to intend to compare unexported fields, but doing so broke the test, I
added a BUG comment.
Signed-off-by: Nic Cope <negz@rk0n.org>