Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a problematic test and add a basic Dispatchfile #1118

Merged
merged 4 commits into from
Dec 3, 2019

Conversation

porridge
Copy link
Member

What this PR does / why we need it:

A baby step towards resolving #1054

Regarding the test:

When go test itself is being run on a (kind) cluster, this test fails
with:

--kubeconfig nor --master was specified.  Using the inClusterConfig.  This
might not work.
--- FAIL: TestNewK2oClient (0.01s)
    kudo_test.go:32: assertion failed: expected error to contain "invalid
configuration: no configuration has been provided", got operators:
customresourcedefinitions.apiextensions.k8s.io "operators.kudo.dev" is
forbidden: User "system:serviceaccount:dispatch:local-runner" cannot get
resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at
the cluster scope

This is because of this special case in
BuildConfigFromFlags

which falls back to restclient.InClusterConfig() when available.
Regardless of whether this config is usable in a dispatch kind cluster or
not, this special case proves the assumption that this test makes
("it is not possible to create a client without a config") wrong in
general.

Therefore removing this test altogether seems like the best course of
action.

When `go test` itself is being run on a (kind) cluster, this test fails
with:
```
W1119 10:50:47.569598   12523 client_config.go:541] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
--- FAIL: TestNewK2oClient (0.01s)
     kudo_test.go:32: assertion failed: expected error to contain "invalid configuration: no configuration has been provided", got operators: customresourcedefinitions.apiextensions.k8s.io "operators.kudo.dev" is forbidden: User "system:serviceaccount:dispatch:local-runner" cannot get resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope
```

This is because of [this special case in `BuildConfigFromFlags`](https://github.com/kubernetes/client-go/blob/571c0ef67034a5e72b9e30e662044b770361641e/tools/clientcmd/client_config.go#L542-L546)
which falls back to `restclient.InClusterConfig()` when available.
Regardless of whether this config is usable in a `dispatch` kind cluster
or not, this special case proves the assumption that this test makes
("it is not possible to create a client without a config") wrong in
general.

Therefore removing this test altogether seems like the best course of
action.
@porridge
Copy link
Member Author

porridge commented Dec 2, 2019

/test

Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@porridge porridge merged commit 1edf03d into kudobuilder:master Dec 3, 2019
@porridge porridge deleted the 1054-remove-test branch December 3, 2019 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants