From d3cc0d7b8b79acb7b803949336f1407fc2c04104 Mon Sep 17 00:00:00 2001 From: Nilanjan Daw Date: Fri, 18 Feb 2022 14:30:10 +0530 Subject: [PATCH] Add unit tests for k8s install and uninstall components of agent reconciler (#388) Add unit tests for the installK8sComponents and uninstallk8sComponents functions within reconcile. However, since these functions deal with the actual installation of the k8s components, the Install() and Uninstall() methods are being mocked. A new interface K8sInstaller has been introduced to allow counterfeiter to mock the methods. --- agent/main.go | 17 +- agent/reconciler/host_reconciler.go | 40 ++-- agent/reconciler/reconciler_suite_test.go | 2 + agent/reconciler/reconciler_test.go | 90 ++++---- .../reconcilerfakes/fake_ik8s_installer.go | 193 ++++++++++++++++++ .../reconcilerfakes/fake_installer.go | 193 ------------------ 6 files changed, 274 insertions(+), 261 deletions(-) create mode 100644 agent/reconciler/reconcilerfakes/fake_ik8s_installer.go delete mode 100644 agent/reconciler/reconcilerfakes/fake_installer.go diff --git a/agent/main.go b/agent/main.go index 44815ede0..0ed74e8d2 100644 --- a/agent/main.go +++ b/agent/main.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit" + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/installer" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/registration" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/version" @@ -79,6 +80,7 @@ var ( downloadpath string skipInstallation bool printVersion bool + k8sInstaller reconciler.IK8sInstaller ) // TODO - fix logging @@ -149,6 +151,16 @@ func main() { return } + if skipInstallation { + k8sInstaller = nil + logger.Info("skip-installation flag set, skipping installer initialisation") + } else { + k8sInstaller, err = installer.New(downloadpath, logger) + if err != nil { + logger.Error(err, "failed to instantiate installer") + } + } + hostReconciler := &reconciler.HostReconciler{ Client: k8sClient, CmdRunner: cloudinit.CmdRunner{}, @@ -158,9 +170,8 @@ func main() { DefaultNetworkInterfaceName: registration.LocalHostRegistrar.ByoHostInfo.DefaultNetworkInterfaceName, }, }, - SkipInstallation: skipInstallation, - DownloadPath: downloadpath, - Recorder: mgr.GetEventRecorderFor("hostagent-controller"), + Recorder: mgr.GetEventRecorderFor("hostagent-controller"), + K8sInstaller: k8sInstaller, } if err = hostReconciler.SetupWithManager(context.TODO(), mgr); err != nil { logger.Error(err, "unable to create controller") diff --git a/agent/reconciler/host_reconciler.go b/agent/reconciler/host_reconciler.go index 628aea285..4748b964f 100644 --- a/agent/reconciler/host_reconciler.go +++ b/agent/reconciler/host_reconciler.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit" - "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/installer" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/registration" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/common" corev1 "k8s.io/api/core/v1" @@ -28,14 +27,21 @@ import ( infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1" ) +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate + +//counterfeiter:generate . IK8sInstaller +type IK8sInstaller interface { + Install(string, string, string) error + Uninstall(string, string, string) error +} + type HostReconciler struct { - Client client.Client - CmdRunner cloudinit.ICmdRunner - FileWriter cloudinit.IFileWriter - TemplateParser cloudinit.ITemplateParser - Recorder record.EventRecorder - SkipInstallation bool - DownloadPath string + Client client.Client + CmdRunner cloudinit.ICmdRunner + FileWriter cloudinit.IFileWriter + TemplateParser cloudinit.ITemplateParser + Recorder record.EventRecorder + K8sInstaller IK8sInstaller } const ( @@ -104,7 +110,7 @@ func (r *HostReconciler) reconcileNormal(ctx context.Context, byoHost *infrastru return ctrl.Result{}, err } - if r.SkipInstallation { + if r.K8sInstaller == nil { logger.Info("Skipping installation of k8s components") } else { err = r.installK8sComponents(ctx, byoHost) @@ -196,7 +202,7 @@ func (r *HostReconciler) hostCleanUp(ctx context.Context, byoHost *infrastructur if err != nil { return err } - if r.SkipInstallation { + if r.K8sInstaller == nil { logger.Info("Skipping uninstallation of k8s components") } else { err = r.uninstallk8sComponents(ctx, byoHost) @@ -254,11 +260,7 @@ func (r *HostReconciler) installK8sComponents(ctx context.Context, byoHost *infr bundleRegistry := byoHost.GetAnnotations()[infrastructurev1beta1.BundleLookupBaseRegistryAnnotation] k8sVersion := byoHost.GetAnnotations()[infrastructurev1beta1.K8sVersionAnnotation] byohBundleTag := byoHost.GetAnnotations()[infrastructurev1beta1.BundleLookupTagAnnotation] - bundleInstaller, err := installer.New(r.DownloadPath, logger) - if err != nil { - return err - } - err = bundleInstaller.Install(bundleRegistry, k8sVersion, byohBundleTag) + err := r.K8sInstaller.Install(bundleRegistry, k8sVersion, byohBundleTag) if err != nil { return err } @@ -269,16 +271,10 @@ func (r *HostReconciler) installK8sComponents(ctx context.Context, byoHost *infr } func (r *HostReconciler) uninstallk8sComponents(ctx context.Context, byoHost *infrastructurev1beta1.ByoHost) error { - logger := ctrl.LoggerFrom(ctx) - bundleRegistry := byoHost.GetAnnotations()[infrastructurev1beta1.BundleLookupBaseRegistryAnnotation] k8sVersion := byoHost.GetAnnotations()[infrastructurev1beta1.K8sVersionAnnotation] byohBundleTag := byoHost.GetAnnotations()[infrastructurev1beta1.BundleLookupTagAnnotation] - bundleInstaller, err := installer.New(r.DownloadPath, logger) - if err != nil { - return err - } - err = bundleInstaller.Uninstall(bundleRegistry, k8sVersion, byohBundleTag) + err := r.K8sInstaller.Uninstall(bundleRegistry, k8sVersion, byohBundleTag) if err != nil { return err } diff --git a/agent/reconciler/reconciler_suite_test.go b/agent/reconciler/reconciler_suite_test.go index 85d361a59..4865f19bc 100644 --- a/agent/reconciler/reconciler_suite_test.go +++ b/agent/reconciler/reconciler_suite_test.go @@ -12,6 +12,7 @@ import ( . "github.com/onsi/gomega" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit/cloudinitfakes" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler" + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler/reconcilerfakes" infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" @@ -39,6 +40,7 @@ var ( fakeCommandRunner *cloudinitfakes.FakeICmdRunner fakeFileWriter *cloudinitfakes.FakeIFileWriter fakeTemplateParser *cloudinitfakes.FakeITemplateParser + fakeInstaller *reconcilerfakes.FakeIK8sInstaller ) var _ = BeforeSuite(func() { diff --git a/agent/reconciler/reconciler_test.go b/agent/reconciler/reconciler_test.go index e0ddb6bc0..d9e5d7ea6 100644 --- a/agent/reconciler/reconciler_test.go +++ b/agent/reconciler/reconciler_test.go @@ -12,6 +12,7 @@ import ( . "github.com/onsi/gomega" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/cloudinit/cloudinitfakes" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler" + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler/reconcilerfakes" infrastructurev1beta1 "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/apis/infrastructure/v1beta1" "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/test/builder" eventutils "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/test/utils/events" @@ -41,14 +42,15 @@ var _ = Describe("Byohost Agent Tests", func() { fakeCommandRunner = &cloudinitfakes.FakeICmdRunner{} fakeFileWriter = &cloudinitfakes.FakeIFileWriter{} fakeTemplateParser = &cloudinitfakes.FakeITemplateParser{} + fakeInstaller = &reconcilerfakes.FakeIK8sInstaller{} recorder = record.NewFakeRecorder(32) hostReconciler = &reconciler.HostReconciler{ - Client: k8sClient, - CmdRunner: fakeCommandRunner, - FileWriter: fakeFileWriter, - TemplateParser: fakeTemplateParser, - Recorder: recorder, - SkipInstallation: true, + Client: k8sClient, + CmdRunner: fakeCommandRunner, + FileWriter: fakeFileWriter, + TemplateParser: fakeTemplateParser, + Recorder: recorder, + K8sInstaller: nil, } }) @@ -175,27 +177,28 @@ runCmd: Expect(patchHelper.Patch(ctx, byoHost, patch.WithStatusObservedGeneration{})).NotTo(HaveOccurred()) }) - // It("should set K8sComponentsInstallationSucceeded to false with Reason K8sComponentsInstallationFailedReason if Install fails", func() { - // fakeInstaller.InstallReturns(errors.New("k8s components install failed")) + It("should set K8sComponentsInstallationSucceeded to false with Reason K8sComponentsInstallationFailedReason if Install fails", func() { + hostReconciler.K8sInstaller = fakeInstaller + fakeInstaller.InstallReturns(errors.New("k8s components install failed")) - // result, reconcilerErr := hostReconciler.Reconcile(ctx, controllerruntime.Request{ - // NamespacedName: byoHostLookupKey, - // }) - // Expect(result).To(Equal(controllerruntime.Result{})) - // Expect(reconcilerErr).To(HaveOccurred()) + result, reconcilerErr := hostReconciler.Reconcile(ctx, controllerruntime.Request{ + NamespacedName: byoHostLookupKey, + }) + Expect(result).To(Equal(controllerruntime.Result{})) + Expect(reconcilerErr).To(HaveOccurred()) - // updatedByoHost := &infrastructurev1beta1.ByoHost{} - // err := k8sClient.Get(ctx, byoHostLookupKey, updatedByoHost) - // Expect(err).ToNot(HaveOccurred()) + updatedByoHost := &infrastructurev1beta1.ByoHost{} + err := k8sClient.Get(ctx, byoHostLookupKey, updatedByoHost) + Expect(err).ToNot(HaveOccurred()) - // k8sComponentsInstallationSucceeded := conditions.Get(updatedByoHost, infrastructurev1beta1.K8sComponentsInstallationSucceeded) - // Expect(*k8sComponentsInstallationSucceeded).To(conditions.MatchCondition(clusterv1.Condition{ - // Type: infrastructurev1beta1.K8sComponentsInstallationSucceeded, - // Status: corev1.ConditionFalse, - // Reason: infrastructurev1beta1.K8sComponentsInstallationFailedReason, - // Severity: clusterv1.ConditionSeverityInfo, - // })) - // }) + k8sComponentsInstallationSucceeded := conditions.Get(updatedByoHost, infrastructurev1beta1.K8sComponentsInstallationSucceeded) + Expect(*k8sComponentsInstallationSucceeded).To(conditions.MatchCondition(clusterv1.Condition{ + Type: infrastructurev1beta1.K8sComponentsInstallationSucceeded, + Status: corev1.ConditionFalse, + Reason: infrastructurev1beta1.K8sComponentsInstallationFailedReason, + Severity: clusterv1.ConditionSeverityInfo, + })) + }) It("should set K8sNodeBootstrapSucceeded to false with Reason CloudInitExecutionFailedReason if the bootstrap execution fails", func() { fakeCommandRunner.RunCmdReturns(errors.New("I failed")) @@ -428,25 +431,26 @@ runCmd: })) }) - // It("should return error if uninstall fails", func() { - // fakeInstaller.UninstallReturns(errors.New("uninstall failed")) - // result, reconcilerErr := hostReconciler.Reconcile(ctx, controllerruntime.Request{ - // NamespacedName: byoHostLookupKey, - // }) - // Expect(result).To(Equal(controllerruntime.Result{})) - // Expect(reconcilerErr.Error()).To(Equal("uninstall failed")) - - // updatedByoHost := &infrastructurev1beta1.ByoHost{} - // err := k8sClient.Get(ctx, byoHostLookupKey, updatedByoHost) - // Expect(err).ToNot(HaveOccurred()) - - // k8sNodeBootstrapSucceeded := conditions.Get(updatedByoHost, infrastructurev1beta1.K8sNodeBootstrapSucceeded) - // Expect(*k8sNodeBootstrapSucceeded).To(conditions.MatchCondition(clusterv1.Condition{ - // Type: infrastructurev1beta1.K8sNodeBootstrapSucceeded, - // Status: corev1.ConditionTrue, - // })) - - // }) + It("should return error if uninstall fails", func() { + hostReconciler.K8sInstaller = fakeInstaller + fakeInstaller.UninstallReturns(errors.New("uninstall failed")) + result, reconcilerErr := hostReconciler.Reconcile(ctx, controllerruntime.Request{ + NamespacedName: byoHostLookupKey, + }) + Expect(result).To(Equal(controllerruntime.Result{})) + Expect(reconcilerErr.Error()).To(Equal("uninstall failed")) + + updatedByoHost := &infrastructurev1beta1.ByoHost{} + err := k8sClient.Get(ctx, byoHostLookupKey, updatedByoHost) + Expect(err).ToNot(HaveOccurred()) + + k8sNodeBootstrapSucceeded := conditions.Get(updatedByoHost, infrastructurev1beta1.K8sNodeBootstrapSucceeded) + Expect(*k8sNodeBootstrapSucceeded).To(conditions.MatchCondition(clusterv1.Condition{ + Type: infrastructurev1beta1.K8sNodeBootstrapSucceeded, + Status: corev1.ConditionTrue, + })) + + }) }) AfterEach(func() { diff --git a/agent/reconciler/reconcilerfakes/fake_ik8s_installer.go b/agent/reconciler/reconcilerfakes/fake_ik8s_installer.go new file mode 100644 index 000000000..f74ad7aff --- /dev/null +++ b/agent/reconciler/reconcilerfakes/fake_ik8s_installer.go @@ -0,0 +1,193 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package reconcilerfakes + +import ( + "sync" + + "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler" +) + +type FakeIK8sInstaller struct { + InstallStub func(string, string, string) error + installMutex sync.RWMutex + installArgsForCall []struct { + arg1 string + arg2 string + arg3 string + } + installReturns struct { + result1 error + } + installReturnsOnCall map[int]struct { + result1 error + } + UninstallStub func(string, string, string) error + uninstallMutex sync.RWMutex + uninstallArgsForCall []struct { + arg1 string + arg2 string + arg3 string + } + uninstallReturns struct { + result1 error + } + uninstallReturnsOnCall map[int]struct { + result1 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeIK8sInstaller) Install(arg1 string, arg2 string, arg3 string) error { + fake.installMutex.Lock() + ret, specificReturn := fake.installReturnsOnCall[len(fake.installArgsForCall)] + fake.installArgsForCall = append(fake.installArgsForCall, struct { + arg1 string + arg2 string + arg3 string + }{arg1, arg2, arg3}) + stub := fake.InstallStub + fakeReturns := fake.installReturns + fake.recordInvocation("Install", []interface{}{arg1, arg2, arg3}) + fake.installMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIK8sInstaller) InstallCallCount() int { + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + return len(fake.installArgsForCall) +} + +func (fake *FakeIK8sInstaller) InstallCalls(stub func(string, string, string) error) { + fake.installMutex.Lock() + defer fake.installMutex.Unlock() + fake.InstallStub = stub +} + +func (fake *FakeIK8sInstaller) InstallArgsForCall(i int) (string, string, string) { + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + argsForCall := fake.installArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIK8sInstaller) InstallReturns(result1 error) { + fake.installMutex.Lock() + defer fake.installMutex.Unlock() + fake.InstallStub = nil + fake.installReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIK8sInstaller) InstallReturnsOnCall(i int, result1 error) { + fake.installMutex.Lock() + defer fake.installMutex.Unlock() + fake.InstallStub = nil + if fake.installReturnsOnCall == nil { + fake.installReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.installReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIK8sInstaller) Uninstall(arg1 string, arg2 string, arg3 string) error { + fake.uninstallMutex.Lock() + ret, specificReturn := fake.uninstallReturnsOnCall[len(fake.uninstallArgsForCall)] + fake.uninstallArgsForCall = append(fake.uninstallArgsForCall, struct { + arg1 string + arg2 string + arg3 string + }{arg1, arg2, arg3}) + stub := fake.UninstallStub + fakeReturns := fake.uninstallReturns + fake.recordInvocation("Uninstall", []interface{}{arg1, arg2, arg3}) + fake.uninstallMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIK8sInstaller) UninstallCallCount() int { + fake.uninstallMutex.RLock() + defer fake.uninstallMutex.RUnlock() + return len(fake.uninstallArgsForCall) +} + +func (fake *FakeIK8sInstaller) UninstallCalls(stub func(string, string, string) error) { + fake.uninstallMutex.Lock() + defer fake.uninstallMutex.Unlock() + fake.UninstallStub = stub +} + +func (fake *FakeIK8sInstaller) UninstallArgsForCall(i int) (string, string, string) { + fake.uninstallMutex.RLock() + defer fake.uninstallMutex.RUnlock() + argsForCall := fake.uninstallArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIK8sInstaller) UninstallReturns(result1 error) { + fake.uninstallMutex.Lock() + defer fake.uninstallMutex.Unlock() + fake.UninstallStub = nil + fake.uninstallReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIK8sInstaller) UninstallReturnsOnCall(i int, result1 error) { + fake.uninstallMutex.Lock() + defer fake.uninstallMutex.Unlock() + fake.UninstallStub = nil + if fake.uninstallReturnsOnCall == nil { + fake.uninstallReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.uninstallReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIK8sInstaller) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.installMutex.RLock() + defer fake.installMutex.RUnlock() + fake.uninstallMutex.RLock() + defer fake.uninstallMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeIK8sInstaller) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ reconciler.IK8sInstaller = new(FakeIK8sInstaller) diff --git a/agent/reconciler/reconcilerfakes/fake_installer.go b/agent/reconciler/reconcilerfakes/fake_installer.go deleted file mode 100644 index debfa04b1..000000000 --- a/agent/reconciler/reconcilerfakes/fake_installer.go +++ /dev/null @@ -1,193 +0,0 @@ -// // Code generated by counterfeiter. DO NOT EDIT. -package reconcilerfakes - -// import ( -// "sync" - -// "github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/reconciler" -// ) - -// type FakeInstaller struct { -// InstallStub func(string, string, string) error -// installMutex sync.RWMutex -// installArgsForCall []struct { -// arg1 string -// arg2 string -// arg3 string -// } -// installReturns struct { -// result1 error -// } -// installReturnsOnCall map[int]struct { -// result1 error -// } -// UninstallStub func(string, string, string) error -// uninstallMutex sync.RWMutex -// uninstallArgsForCall []struct { -// arg1 string -// arg2 string -// arg3 string -// } -// uninstallReturns struct { -// result1 error -// } -// uninstallReturnsOnCall map[int]struct { -// result1 error -// } -// invocations map[string][][]interface{} -// invocationsMutex sync.RWMutex -// } - -// func (fake *FakeInstaller) Install(arg1 string, arg2 string, arg3 string) error { -// fake.installMutex.Lock() -// ret, specificReturn := fake.installReturnsOnCall[len(fake.installArgsForCall)] -// fake.installArgsForCall = append(fake.installArgsForCall, struct { -// arg1 string -// arg2 string -// arg3 string -// }{arg1, arg2, arg3}) -// stub := fake.InstallStub -// fakeReturns := fake.installReturns -// fake.recordInvocation("Install", []interface{}{arg1, arg2, arg3}) -// fake.installMutex.Unlock() -// if stub != nil { -// return stub(arg1, arg2, arg3) -// } -// if specificReturn { -// return ret.result1 -// } -// return fakeReturns.result1 -// } - -// func (fake *FakeInstaller) InstallCallCount() int { -// fake.installMutex.RLock() -// defer fake.installMutex.RUnlock() -// return len(fake.installArgsForCall) -// } - -// func (fake *FakeInstaller) InstallCalls(stub func(string, string, string) error) { -// fake.installMutex.Lock() -// defer fake.installMutex.Unlock() -// fake.InstallStub = stub -// } - -// func (fake *FakeInstaller) InstallArgsForCall(i int) (string, string, string) { -// fake.installMutex.RLock() -// defer fake.installMutex.RUnlock() -// argsForCall := fake.installArgsForCall[i] -// return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -// } - -// func (fake *FakeInstaller) InstallReturns(result1 error) { -// fake.installMutex.Lock() -// defer fake.installMutex.Unlock() -// fake.InstallStub = nil -// fake.installReturns = struct { -// result1 error -// }{result1} -// } - -// func (fake *FakeInstaller) InstallReturnsOnCall(i int, result1 error) { -// fake.installMutex.Lock() -// defer fake.installMutex.Unlock() -// fake.InstallStub = nil -// if fake.installReturnsOnCall == nil { -// fake.installReturnsOnCall = make(map[int]struct { -// result1 error -// }) -// } -// fake.installReturnsOnCall[i] = struct { -// result1 error -// }{result1} -// } - -// func (fake *FakeInstaller) Uninstall(arg1 string, arg2 string, arg3 string) error { -// fake.uninstallMutex.Lock() -// ret, specificReturn := fake.uninstallReturnsOnCall[len(fake.uninstallArgsForCall)] -// fake.uninstallArgsForCall = append(fake.uninstallArgsForCall, struct { -// arg1 string -// arg2 string -// arg3 string -// }{arg1, arg2, arg3}) -// stub := fake.UninstallStub -// fakeReturns := fake.uninstallReturns -// fake.recordInvocation("Uninstall", []interface{}{arg1, arg2, arg3}) -// fake.uninstallMutex.Unlock() -// if stub != nil { -// return stub(arg1, arg2, arg3) -// } -// if specificReturn { -// return ret.result1 -// } -// return fakeReturns.result1 -// } - -// func (fake *FakeInstaller) UninstallCallCount() int { -// fake.uninstallMutex.RLock() -// defer fake.uninstallMutex.RUnlock() -// return len(fake.uninstallArgsForCall) -// } - -// func (fake *FakeInstaller) UninstallCalls(stub func(string, string, string) error) { -// fake.uninstallMutex.Lock() -// defer fake.uninstallMutex.Unlock() -// fake.UninstallStub = stub -// } - -// func (fake *FakeInstaller) UninstallArgsForCall(i int) (string, string, string) { -// fake.uninstallMutex.RLock() -// defer fake.uninstallMutex.RUnlock() -// argsForCall := fake.uninstallArgsForCall[i] -// return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -// } - -// func (fake *FakeInstaller) UninstallReturns(result1 error) { -// fake.uninstallMutex.Lock() -// defer fake.uninstallMutex.Unlock() -// fake.UninstallStub = nil -// fake.uninstallReturns = struct { -// result1 error -// }{result1} -// } - -// func (fake *FakeInstaller) UninstallReturnsOnCall(i int, result1 error) { -// fake.uninstallMutex.Lock() -// defer fake.uninstallMutex.Unlock() -// fake.UninstallStub = nil -// if fake.uninstallReturnsOnCall == nil { -// fake.uninstallReturnsOnCall = make(map[int]struct { -// result1 error -// }) -// } -// fake.uninstallReturnsOnCall[i] = struct { -// result1 error -// }{result1} -// } - -// func (fake *FakeInstaller) Invocations() map[string][][]interface{} { -// fake.invocationsMutex.RLock() -// defer fake.invocationsMutex.RUnlock() -// fake.installMutex.RLock() -// defer fake.installMutex.RUnlock() -// fake.uninstallMutex.RLock() -// defer fake.uninstallMutex.RUnlock() -// copiedInvocations := map[string][][]interface{}{} -// for key, value := range fake.invocations { -// copiedInvocations[key] = value -// } -// return copiedInvocations -// } - -// func (fake *FakeInstaller) recordInvocation(key string, args []interface{}) { -// fake.invocationsMutex.Lock() -// defer fake.invocationsMutex.Unlock() -// if fake.invocations == nil { -// fake.invocations = map[string][][]interface{}{} -// } -// if fake.invocations[key] == nil { -// fake.invocations[key] = [][]interface{}{} -// } -// fake.invocations[key] = append(fake.invocations[key], args) -// } - -// var _ reconciler.Installer = new(FakeInstaller)