-
Notifications
You must be signed in to change notification settings - Fork 228
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
allow image updates to be forced if container not present #181 #189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -56,6 +56,26 @@ func Test_GetImagesFromApplication(t *testing.T) { | |||
imageList := GetImagesFromApplication(application) | ||||
assert.Empty(t, imageList) | ||||
}) | ||||
|
||||
t.Run("Get list of images from application that has force-update", func(t *testing.T) { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests are always appreciated, thank you! 👍 |
||||
application := &v1alpha1.Application{ | ||||
ObjectMeta: v1.ObjectMeta{ | ||||
Name: "test-app", | ||||
Namespace: "argocd", | ||||
Annotations: map[string]string{ | ||||
fmt.Sprintf(common.ForceUpdateOptionAnnotation, "nginx"): "true", | ||||
common.ImageUpdaterAnnotation: "nginx=nginx", | ||||
}, | ||||
}, | ||||
Spec: v1alpha1.ApplicationSpec{}, | ||||
Status: v1alpha1.ApplicationStatus{ | ||||
Summary: v1alpha1.ApplicationSummary{}, | ||||
}, | ||||
} | ||||
imageList := GetImagesFromApplication(application) | ||||
require.Len(t, imageList, 1) | ||||
assert.Equal(t, "nginx", imageList[0].ImageName) | ||||
}) | ||||
} | ||||
|
||||
func Test_GetApplicationType(t *testing.T) { | ||||
|
@@ -702,3 +722,10 @@ func TestKubernetesClient_UpdateSpec_Conflict(t *testing.T) { | |||
|
||||
assert.Equal(t, "https://github.com/argoproj/argocd-example-apps", spec.Source.RepoURL) | ||||
} | ||||
|
||||
func Test_parseImageList(t *testing.T) { | ||||
assert.Equal(t, []string{"foo", "bar"}, parseImageList(" foo, bar ").Originals()) | ||||
// should whitespace inside the spec be preserved? | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think whitespace stripping should be done here, but let's do that in another PR: argocd-image-updater/pkg/image/image.go Line 133 in f1cc8e4
|
||||
assert.Equal(t, []string{"foo", "bar", "baz = qux"}, parseImageList(" foo, bar,baz = qux ").Originals()) | ||||
assert.Equal(t, []string{"foo", "bar", "baz=qux"}, parseImageList("foo,bar,baz=qux").Originals()) | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for documentation update :)