@@ -214,9 +214,9 @@ func TestPackageRepository(t *testing.T) {
214214 _ , _ = kappCtrl .RunWithOpts ([]string {"package" , "repository" , "add" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef }, RunOpts {
215215 AllowError : true })
216216
217- pkgrYaml := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
217+ pkgrJson := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
218218 pkgr := & kcpkg.PackageRepository {}
219- err := json .Unmarshal ([]byte (pkgrYaml ), pkgr )
219+ err := json .Unmarshal ([]byte (pkgrJson ), pkgr )
220220 require .NoError (t , err )
221221 require .Equal (t , pkgrSecretRef , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
222222
@@ -233,22 +233,35 @@ func TestPackageRepository(t *testing.T) {
233233 kappCtrl .RunWithOpts ([]string {"package" , "repository" , "update" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef }, RunOpts {
234234 AllowError : true })
235235
236- pkgrYaml := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
236+ pkgrJson := kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
237237 pkgr := & kcpkg.PackageRepository {}
238- err = json .Unmarshal ([]byte (pkgrYaml ), pkgr )
238+ err = json .Unmarshal ([]byte (pkgrJson ), pkgr )
239239 require .NoError (t , err )
240240 require .Equal (t , pkgrSecretRef , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
241241
242242 // update to a new secret
243243 kappCtrl .RunWithOpts ([]string {"package" , "repository" , "update" , "-r" , pkgrWithSecretName , "--url" , pkgrURL , "--secret-ref" , pkgrSecretRef + "-2" }, RunOpts {
244244 AllowError : true })
245245
246- pkgrYaml = kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
246+ pkgrJson = kubectl .Run ([]string {"get" , kind , pkgrWithSecretName , "-ojson" })
247247 pkgr = & kcpkg.PackageRepository {}
248- err = json .Unmarshal ([]byte (pkgrYaml ), pkgr )
248+ err = json .Unmarshal ([]byte (pkgrJson ), pkgr )
249249 require .NoError (t , err )
250250 require .Equal (t , pkgrSecretRef + "-2" , pkgr .Spec .Fetch .ImgpkgBundle .SecretRef .Name )
251251 })
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+ })
252265}
253266
254267func TestPackageRepositoryTagSemver (t * testing.T ) {
0 commit comments