@@ -134,6 +134,17 @@ var _ = Describe("Add", func() {
134
134
Expect (err ).To (MatchError ("failed to make GET request to service weave-system/wego-app path \" /v1/profiles\" : nope" ))
135
135
})
136
136
137
+ It ("fails if it's unable to discover the HelmRepository's name and namespace values" , func () {
138
+ gitProviders .RepositoryExistsReturns (true , nil )
139
+ gitProviders .GetRepoFilesReturns (makeTestFiles (), nil )
140
+ clientSet .AddProxyReactor ("services" , func (action testing.Action ) (handled bool , ret restclient.ResponseWrapper , err error ) {
141
+ return true , newFakeResponseWrapper (getRespWithoutHelmRepo ()), nil
142
+ })
143
+ err := profilesSvc .Add (context .TODO (), gitProviders , addOptions )
144
+ Expect (err ).NotTo (BeNil ())
145
+ Expect (err ).To (MatchError ("failed to discover HelmRepository's name and namespace" ))
146
+ })
147
+
137
148
It ("fails if the config repo's filesystem could not be fetched" , func () {
138
149
gitProviders .RepositoryExistsReturns (true , nil )
139
150
clientSet .AddProxyReactor ("services" , func (action testing.Action ) (handled bool , ret restclient.ResponseWrapper , err error ) {
@@ -298,3 +309,34 @@ func makeTestFiles() []*gitprovider.CommitFile {
298
309
}
299
310
return commitFiles
300
311
}
312
+
313
+ func getRespWithoutHelmRepo () string {
314
+ return `{
315
+ "profiles": [
316
+ {
317
+ "name": "podinfo",
318
+ "home": "https://github.com/stefanprodan/podinfo",
319
+ "sources": [
320
+ "https://github.com/stefanprodan/podinfo"
321
+ ],
322
+ "description": "Podinfo Helm chart for Kubernetes",
323
+ "keywords": [],
324
+ "maintainers": [
325
+ {
326
+ "name": "stefanprodan",
327
+
328
+ "url": ""
329
+ }
330
+ ],
331
+ "icon": "",
332
+ "annotations": {},
333
+ "kubeVersion": ">=1.19.0-0",
334
+ "availableVersions": [
335
+ "6.0.0",
336
+ "6.0.1"
337
+ ]
338
+ }
339
+ ]
340
+ }
341
+ `
342
+ }
0 commit comments