diff options
| author | jannfis <jann@mistrust.net> | 2020-08-12 13:37:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-12 13:37:31 +0200 |
| commit | 526e78703986c5ee990ecbc039543aa8dcd32268 (patch) | |
| tree | 4ccdd647c754c11bbf70d2ddca33a03735e361b0 /cmd | |
| parent | 420ddf92b2476f3a822b9458dbbe2c47e7320c47 (diff) | |
refactor: Make ArgoCD client mockable and add unit tests (#44)
* refactor: Make ArgoCD client mockable and add unit tests
* Allow some more words in spelling
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/main.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/main.go b/cmd/main.go index b1e84e5..5ece20f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -33,7 +33,7 @@ type ImageUpdaterConfig struct { ArgocdNamespace string DryRun bool CheckInterval time.Duration - ArgoClient *argocd.ArgoCD + ArgoClient argocd.ArgoCD LogLevel string KubeClient *client.KubernetesClient MaxConcurrency int @@ -51,7 +51,7 @@ type ImageUpdaterResult struct { } // Update all images of a single application. Will run in a goroutine. -func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesClient, curApplication *argocd.ApplicationImages, dryRun bool) ImageUpdaterResult { +func updateApplication(argoClient argocd.ArgoCD, kubeClient *client.KubernetesClient, curApplication *argocd.ApplicationImages, dryRun bool) ImageUpdaterResult { result := ImageUpdaterResult{} app := curApplication.Application.GetName() @@ -158,9 +158,9 @@ func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesC imgCtx.Infof("Upgrading image to %s", applicationImage.WithTag(latest).String()) if appType := argocd.GetApplicationType(&curApplication.Application); appType == argocd.ApplicationTypeKustomize { - err = argoClient.SetKustomizeImage(&curApplication.Application, updateableImage.WithTag(latest)) + err = argocd.SetKustomizeImage(argoClient, &curApplication.Application, updateableImage.WithTag(latest)) } else if appType == argocd.ApplicationTypeHelm { - err = argoClient.SetHelmImage(&curApplication.Application, updateableImage.WithTag(latest)) + err = argocd.SetHelmImage(argoClient, &curApplication.Application, updateableImage.WithTag(latest)) } else { result.NumErrors += 1 err = fmt.Errorf("Could not update application %s - neither Helm nor Kustomize application", app) |
