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

Fix issue with services controller when load balancing should be disabled #232

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

detiber
Copy link
Member

@detiber detiber commented Mar 2, 2022

When trying to run with the load balancer disabled, currently the controller will panic, because we are testing if an interface is nil rather than if the value of the interface is nil).

Replacing the interface types in the cloud struct with the concrete types resolves the issue and as far as I can tell does not impact anything else.

…bled

Signed-off-by: Jason DeTiberus <detiber@users.noreply.github.com>
metal/cloud.go Show resolved Hide resolved
Comment on lines -31 to -34
var (
validCloud *cloud
backend *store.Memory
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing these variables was the easiest way that I could enable testing with different configurations instead of a common shared config.

Comment on lines +88 to +101
func TestLoadBalancerDefaultDisabled(t *testing.T) {
vc, _ := testGetValidCloud(t, "")
response, supported := vc.LoadBalancer()
var (
expectedSupported = false
expectedResponse = response
)
if supported != expectedSupported {
t.Errorf("supported returned %v instead of expected %v", supported, expectedSupported)
}
if response != expectedResponse {
t.Errorf("value returned %v instead of expected %v", response, expectedResponse)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was previously returning true erroneously, now it properly returns false.

}
if response != expectedResponse {
t.Errorf("value returned %v instead of expected %v", response, expectedResponse)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping these because we don't have a k8s client plumbed through for the code paths to be able to run.

Comment on lines +135 to +137
func TestLoadBalancerKubeVIP(t *testing.T) {
t.Skip("Test needs a k8s client to work")
vc, _ := testGetValidCloud(t, "kube-vip://")
Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping these because we don't have a k8s client plumbed through for the code paths to be able to run.

@deitch deitch merged commit d1bff8d into kubernetes-sigs:master Mar 7, 2022
@detiber detiber deleted the cleanup branch March 7, 2022 19:56
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