Skip to content

Commit 8efffa2

Browse files
author
Per Goncalves da Silva
committed
test fix
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 829e5f6 commit 8efffa2

File tree

2 files changed

+22
-0
lines changed
  • staging/operator-lifecycle-manager/pkg/controller/registry/resolver
  • vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver

2 files changed

+22
-0
lines changed

staging/operator-lifecycle-manager/pkg/controller/registry/resolver/source_csvs.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ func (csp *csvSourceProvider) Sources(namespaces ...string) map[cache.SourceKey]
4040
listSubscriptions: func(ctx context.Context) (*v1alpha1.SubscriptionList, error) {
4141
return csp.client.OperatorsV1alpha1().Subscriptions(namespace).List(ctx, metav1.ListOptions{})
4242
},
43+
getCSV: func(ctx context.Context, namespace string, name string) (*v1alpha1.ClusterServiceVersion, error) {
44+
return csp.client.OperatorsV1alpha1().ClusterServiceVersions(namespace).Get(ctx, name, metav1.GetOptions{})
45+
},
4346
}
4447
break // first ns is assumed to be the target ns, todo: make explicit
4548
}
@@ -54,6 +57,7 @@ type csvSource struct {
5457
logger logrus.StdLogger
5558

5659
listSubscriptions func(context.Context) (*v1alpha1.SubscriptionList, error)
60+
getCSV func(ctx context.Context, namespace string, name string) (*v1alpha1.ClusterServiceVersion, error)
5761
}
5862

5963
func (s *csvSource) Snapshot(ctx context.Context) (*cache.Snapshot, error) {
@@ -105,6 +109,13 @@ func (s *csvSource) Snapshot(ctx context.Context) (*cache.Snapshot, error) {
105109
return nil, fmt.Errorf("lister caches incoherent for CSV %s/%s - found owning Subscription %s/%s", csv.Namespace, csv.Name, realSubscription.Namespace, realSubscription.Name)
106110
}
107111
}
112+
realCsv, err := s.getCSV(ctx, csv.Namespace, csv.Name)
113+
if err != nil {
114+
return nil, fmt.Errorf("lister caches might be incoherent for CSV %s/%s: %w", csv.Namespace, csv.Name, err)
115+
}
116+
if realCsv.GetUID() != csv.GetUID() {
117+
return nil, fmt.Errorf("lister caches incoherent for CSV %s/%s: differing UIDs", csv.Namespace, csv.Name)
118+
}
108119
}
109120

110121
if failForwardEnabled {

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/source_csvs.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)