INNER CODE UNIT · Go
TestConfigTracker_HasConfigChanged_ShouldReturnErrorWhenAPIServerIsDown
fluxcd/flagger · pkg/canary/config_tracker_test.go:370
func TestConfigTracker_HasConfigChanged_ShouldReturnErrorWhenAPIServerIsDown(t *testing.T) {
t.Run("secret", func(t *testing.T) {
dc := deploymentConfigs{name: "podinfo", label: "name", labelValue: "podinfo"}
mocks, kubeClient := newCustomizableFixture(dc)
kubeClient.PrependReactor("get", "secrets", func(action k8sTesting.Action) (bool, runtime.Object, error) {
return true, nil, errors.New("server error")
})
_, err := mocks.controller.configTracker.HasConfigChanged(mocks.canary)
assert.Error(t, err)
})
t.Run("configmap", func(t *testing.T) {
dc := deploymentConfigs{name: "podinfo", label: "name", labelValue: "podinfo"}
mocks, kubeClient := newCustomizableFixture(dc)
kubeClient.PrependReactor("get", "configmaps", func(action k8sTesting.Action) (bool, runtime.Object, error) {