... to simplify and benefit from Go 1.17.
In some cases, wrap tests in testing.T.Run() to decrease
the scope, or to make the relationship between the test and the
cleanup clearer. In some cases it's still a bit awkward
because there is no testing.T.Unsetenv, but still worth it.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
imdario/mergo, despite its official documentation, does not merge
public fields inside private fields as of v.0.3.9:
https://github.com/imdario/mergo/issues/139
Fixing that seems non-trivial.
Instead, make the restTLSClientConfig a public field of restConfig.
The restConfig type itself remains private, so this does not make anything
actually public outside the subpackage. This way, the calls to mergo work
as expected with both 0.3.8 and 0.3.9.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
github.com/imdario/mergo has changed behavior incompatibly;
verify that the parsing works as expected.
The kubeconfig fixture contains invalid data for certificates and private
keys to make the current tests easier to read - but that also prevents
testing restClientFor and its callers which actually need the data.
Right now I prefer readable tests for the parts we care about, eventually
the fixture might be updated with real data - but, ultimately, that is
already tested in Skopeo integration tests, so testing it here as well
is not that important (considering the atomic: transport is deprecated
already).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>