Commit Graph

5 Commits

Author SHA1 Message Date
Miloslav Trmač 66d480a0da Convert openshift from ghodss/yaml to gopkg.in/yaml.v3
This requires us to _manually_ deal with the bytes-as-base64-strings
format.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-01-30 19:16:17 +01:00
Miloslav Trmač a56436cb15 Use testing.T.Setenv instead of os.Setenv in tests
... 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>
2022-06-14 20:57:04 +02:00
Miloslav Trmač f0d818b27c Use Testing.T.Cleanup() to simplify tests
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-03-17 20:35:00 +01:00
Miloslav Trmač 9b0b603c14 Make restTLSClientConfig in restConfig a public field
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>
2020-03-26 22:19:31 +01:00
Miloslav Trmač 4ffc973d91 Add tests for parsing OpenShift kubeconfig files
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>
2019-09-27 21:40:19 +02:00