Skip to content

Commit

Permalink
Ignore errors that might happen when getting Devfile Registries from …
Browse files Browse the repository at this point in the history
…the cluster (#6639)
  • Loading branch information
rm3l authored Mar 7, 2023
1 parent ef6489c commit f001676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ func (o RegistryClient) GetDevfileRegistries(registryName string) ([]api.Registr
if o.kubeClient != nil {
clusterRegistries, err := o.kubeClient.GetRegistryList()
if err != nil {
return nil, err
// #6636 : errors should not be blocking
klog.V(3).Infof("failed to get Devfile registries from the cluster: %v", err)
} else {
allRegistries = append(allRegistries, clusterRegistries...)
}
allRegistries = append(allRegistries, clusterRegistries...)
}
allRegistries = append(allRegistries, o.preferenceClient.RegistryList()...)

Expand Down
14 changes: 12 additions & 2 deletions pkg/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,18 @@ OdoSettings:
result.EXPECT().GetRegistryList().Return(nil, errors.New("an error"))
return result
},
wantErr: true,
want: []api.Registry{
{
Name: "CheDevfileRegistry",
URL: "https://che-devfile-registry.openshift.io/",
Secure: false,
},
{
Name: "DefaultDevfileRegistry",
URL: "https://registry.devfile.io",
Secure: false,
},
},
},
}

Expand All @@ -139,7 +150,6 @@ OdoSettings:
ctrl := gomock.NewController(t)

prefClient, _ := preference.NewClient(ctx)
// TODO(rm3l) Test with both nil and non-nil kubeclient
var kc kclient.ClientInterface
if tt.kclient != nil {
kc = tt.kclient(ctrl)
Expand Down

0 comments on commit f001676

Please sign in to comment.