Skip to content

Commit 1bea4b7

Browse files
committed
collapse resolver tests
there are no longer two resolvers, so having a separate shared set of test cases doesn't make sense (and means the resolver tests look different from all of the other unit tests) Signed-off-by: Evan <[email protected]>
1 parent 1544350 commit 1bea4b7

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

pkg/controller/registry/resolver/step_resolver_test.go

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,31 @@ var (
4646
Requires4 = APISet4
4747
)
4848

49-
type resolverTest struct {
50-
name string
51-
clusterState []runtime.Object
52-
querier SourceQuerier
53-
bundlesByCatalog map[registry.CatalogKey][]*api.Bundle
54-
out resolverTestOut
55-
}
56-
57-
type resolverTestOut struct {
58-
steps [][]*v1alpha1.Step
59-
lookups []v1alpha1.BundleLookup
60-
subs []*v1alpha1.Subscription
61-
errAssert func(*testing.T, error)
62-
solverError solver.NotSatisfiable
63-
}
64-
65-
func SharedResolverSpecs() []resolverTest {
49+
func TestResolver(t *testing.T) {
6650
const namespace = "catsrc-namespace"
6751
catalog := registry.CatalogKey{Name: "catsrc", Namespace: namespace}
52+
53+
type resolverTestOut struct {
54+
steps [][]*v1alpha1.Step
55+
lookups []v1alpha1.BundleLookup
56+
subs []*v1alpha1.Subscription
57+
errAssert func(*testing.T, error)
58+
solverError solver.NotSatisfiable
59+
}
60+
type resolverTest struct {
61+
name string
62+
clusterState []runtime.Object
63+
querier SourceQuerier
64+
bundlesByCatalog map[registry.CatalogKey][]*api.Bundle
65+
out resolverTestOut
66+
}
67+
6868
nothing := resolverTestOut{
6969
steps: [][]*v1alpha1.Step{},
7070
lookups: []v1alpha1.BundleLookup{},
7171
subs: []*v1alpha1.Subscription{},
7272
}
73-
return []resolverTest{
73+
tests := []resolverTest{
7474
{
7575
name: "SubscriptionOmitsChannel",
7676
clusterState: []runtime.Object{
@@ -640,15 +640,7 @@ func SharedResolverSpecs() []resolverTest {
640640
},
641641
},
642642
},
643-
}
644-
}
645-
646-
func TestResolver(t *testing.T) {
647-
namespace := "catsrc-namespace"
648-
catalog := registry.CatalogKey{"catsrc", namespace}
649-
650-
tests := append(SharedResolverSpecs(),
651-
resolverTest{
643+
{
652644
name: "InstalledSub/UpdatesAvailable/SkipRangeNotInHead",
653645
clusterState: []runtime.Object{
654646
existingSub(namespace, "a.v1", "a", "alpha", catalog),
@@ -668,7 +660,7 @@ func TestResolver(t *testing.T) {
668660
},
669661
},
670662
},
671-
resolverTest{
663+
{
672664
name: "NewSub/StartingCSV",
673665
clusterState: []runtime.Object{
674666
newSub(namespace, "a", "alpha", catalog, withStartingCSV("a.v2")),
@@ -687,7 +679,7 @@ func TestResolver(t *testing.T) {
687679
},
688680
},
689681
},
690-
resolverTest{
682+
{
691683
name: "InstalledSub/UpdatesAvailable/SpecifiedSkips",
692684
clusterState: []runtime.Object{
693685
existingSub(namespace, "a.v1", "a", "alpha", catalog),
@@ -706,7 +698,7 @@ func TestResolver(t *testing.T) {
706698
},
707699
},
708700
},
709-
)
701+
}
710702
for _, tt := range tests {
711703
t.Run(tt.name, func(t *testing.T) {
712704
stopc := make(chan struct{})

0 commit comments

Comments
 (0)