@@ -108,10 +108,10 @@ func TestHandle_changeForUnregisteredTag(t *testing.T) {
108
108
}
109
109
}
110
110
111
- // TestHande_matchScenarios comprehensively tests trigger definitions against
111
+ // TestHandle_matchScenarios comprehensively tests trigger definitions against
112
112
// image repo updates to ensure that the image change triggers match (or don't
113
113
// match) properly.
114
- func TestHande_matchScenarios (t * testing.T ) {
114
+ func TestHandle_matchScenarios (t * testing.T ) {
115
115
params := map [string ]* deployapi.DeploymentTriggerImageChangeParams {
116
116
"params.1" : {
117
117
Automatic : true ,
@@ -133,13 +133,13 @@ func TestHande_matchScenarios(t *testing.T) {
133
133
},
134
134
}
135
135
136
- tagHistoryFor := func (repo , tag , value string ) map [string ]imageapi.TagEventList {
136
+ tagHistoryFor := func (repo , tag , dir , image string ) map [string ]imageapi.TagEventList {
137
137
return map [string ]imageapi.TagEventList {
138
138
tag : {
139
139
Items : []imageapi.TagEvent {
140
140
{
141
- DockerImageReference : fmt .Sprintf ("%s:%s" , repo , value ),
142
- Image : value ,
141
+ DockerImageReference : fmt .Sprintf ("%s:%s" , repo , dir ),
142
+ Image : image ,
143
143
},
144
144
},
145
145
},
@@ -151,30 +151,37 @@ func TestHande_matchScenarios(t *testing.T) {
151
151
ObjectMeta : kapi.ObjectMeta {Name : "repoA" , Namespace : kapi .NamespaceDefault },
152
152
Status : imageapi.ImageRepositoryStatus {
153
153
DockerImageRepository : "registry:8080/openshift/test-image" ,
154
- Tags : tagHistoryFor ("registry:8080/openshift/test-image" , "test-tag" , "ref-2" ),
154
+ Tags : tagHistoryFor ("registry:8080/openshift/test-image" , "test-tag" , "ref-2" , "ref-2" ),
155
155
},
156
156
Tags : map [string ]string {"test-tag" : "ref-2" },
157
157
},
158
158
"repo.2" : {
159
159
ObjectMeta : kapi.ObjectMeta {Name : "repoB" , Namespace : kapi .NamespaceDefault },
160
160
Status : imageapi.ImageRepositoryStatus {
161
161
DockerImageRepository : "registry:8080/openshift/test-image" ,
162
- Tags : tagHistoryFor ("registry:8080/openshift/test-image" , "test-tag" , "ref-3" ),
162
+ Tags : tagHistoryFor ("registry:8080/openshift/test-image" , "test-tag" , "ref-3" , "ref-3" ),
163
163
},
164
164
Tags : map [string ]string {"test-tag" : "ref-3" },
165
165
},
166
166
"repo.3" : {
167
167
ObjectMeta : kapi.ObjectMeta {Name : "repoC" , Namespace : kapi .NamespaceDefault },
168
168
Status : imageapi.ImageRepositoryStatus {
169
169
DockerImageRepository : "registry:8080/openshift/test-image-B" ,
170
- Tags : tagHistoryFor ("registry:8080/openshift/test-image-B" , "test-tag" , "ref-2" ),
170
+ Tags : tagHistoryFor ("registry:8080/openshift/test-image-B" , "test-tag" , "ref-2" , "ref-2" ),
171
171
},
172
172
Tags : map [string ]string {"test-tag" : "ref-2" },
173
173
},
174
174
"repo.4" : {
175
175
ObjectMeta : kapi.ObjectMeta {Name : "repoA" , Namespace : kapi .NamespaceDefault },
176
176
Status : imageapi.ImageRepositoryStatus {
177
- Tags : tagHistoryFor ("default/repoA" , "test-tag" , "ref-2" ),
177
+ Tags : tagHistoryFor ("default/repoA" , "test-tag" , "ref-2" , "ref-2" ),
178
+ },
179
+ Tags : map [string ]string {"test-tag" : "ref-2" },
180
+ },
181
+ "repo.5" : {
182
+ ObjectMeta : kapi.ObjectMeta {Name : "repoA" , Namespace : kapi .NamespaceDefault },
183
+ Status : imageapi.ImageRepositoryStatus {
184
+ Tags : tagHistoryFor ("default/repoA" , "test-tag" , "ref-2" , "" ),
178
185
},
179
186
Tags : map [string ]string {"test-tag" : "ref-2" },
180
187
},
0 commit comments