@@ -214,9 +214,9 @@ func TestPackageRepository(t *testing.T) {
214
214
_ , _ = kappCtrl .RunWithOpts ([]string {"package" , "repository" , "add" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef }, RunOpts {
215
215
AllowError : true })
216
216
217
- pkgrYaml := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
217
+ pkgrJson := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
218
218
pkgr := & kcpkg.PackageRepository {}
219
- err := json .Unmarshal ([]byte (pkgrYaml ), pkgr )
219
+ err := json .Unmarshal ([]byte (pkgrJson ), pkgr )
220
220
require .NoError (t , err )
221
221
require .Equal (t , pkgrSecretRef , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
222
222
@@ -233,22 +233,35 @@ func TestPackageRepository(t *testing.T) {
233
233
kappCtrl .RunWithOpts ([]string {"package" , "repository" , "update" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef }, RunOpts {
234
234
AllowError : true })
235
235
236
- pkgrYaml := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
236
+ pkgrJson := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
237
237
pkgr := & kcpkg.PackageRepository {}
238
- err = json .Unmarshal ([]byte (pkgrYaml ), pkgr )
238
+ err = json .Unmarshal ([]byte (pkgrJson ), pkgr )
239
239
require .NoError (t , err )
240
240
require .Equal (t , pkgrSecretRef , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
241
241
242
242
// update to a new secret
243
243
kappCtrl .RunWithOpts ([]string {"package" , "repository" , "update" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef + "-2" }, RunOpts {
244
244
AllowError : true })
245
245
246
- pkgrYaml = kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
246
+ pkgrJson = kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
247
247
pkgr = & kcpkg.PackageRepository {}
248
- err = json .Unmarshal ([]byte (pkgrYaml ), pkgr )
248
+ err = json .Unmarshal ([]byte (pkgrJson ), pkgr )
249
249
require .NoError (t , err )
250
250
require .Equal (t , pkgrSecretRef + "-2" , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
251
251
})
252
+
253
+ logger .Section ("updating just the url of a repository with secret" , func () {
254
+ // update just the url, secret should be intact
255
+ kappCtrl .RunWithOpts ([]string {"package" , "repository" , "update" , "-r" , pkgrWithSecretName , "--url" , pkgrURL + "-new" }, RunOpts {
256
+ AllowError : true })
257
+
258
+ pkgrJson := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
259
+ pkgr := & kcpkg.PackageRepository {}
260
+ err := json .Unmarshal ([]byte (pkgrJson ), pkgr )
261
+ require .NoError (t , err )
262
+ require .Equal (t , pkgrURL + "-new" , pkgr .Spec .Fetch .ImgpkgBundle .Image )
263
+ require .Equal (t , pkgrSecretRef + "-2" , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
264
+ })
252
265
}
253
266
254
267
func TestPackageRepositoryTagSemver (t * testing.T ) {
0 commit comments