@@ -30,15 +30,15 @@ var _ = Describe("Not found APIs", func() {
30
30
// each entry is an installplan with a deprecated resource
31
31
type payload struct {
32
32
name string
33
- ip * operatorsv1alpha1.InstallPlan
33
+ IP * operatorsv1alpha1.InstallPlan
34
34
errMessage string
35
35
}
36
36
37
37
var tableEntries []table.TableEntry
38
38
tableEntries = []table.TableEntry {
39
39
table .Entry ("contains an entry with a missing API not found on cluster " , payload {
40
40
name : "installplan contains a missing API" ,
41
- ip : & operatorsv1alpha1.InstallPlan {
41
+ IP : & operatorsv1alpha1.InstallPlan {
42
42
ObjectMeta : metav1.ObjectMeta {
43
43
Namespace : * namespace , // this is necessary due to ginkgo table semantics, see https://github.com/onsi/ginkgo/issues/378
44
44
Name : "test-plan-api" ,
@@ -48,41 +48,43 @@ var _ = Describe("Not found APIs", func() {
48
48
Approved : true ,
49
49
ClusterServiceVersionNames : []string {},
50
50
},
51
- Status : operatorsv1alpha1.InstallPlanStatus {
52
- Phase : operatorsv1alpha1 .InstallPlanPhaseInstalling ,
53
- CatalogSources : []string {},
54
- Plan : []* operatorsv1alpha1.Step {
55
- {
56
- Resolving : "test-csv" ,
57
- Status : operatorsv1alpha1 .StepStatusUnknown ,
58
- Resource : operatorsv1alpha1.StepResource {
59
- Name : "my.thing" ,
60
- Group : "verticalpodautoscalers.autoscaling.k8s.io" ,
61
- Version : "v1" ,
62
- Kind : "VerticalPodAutoscaler" ,
63
- Manifest : missingAPI ,
64
- },
65
- },
66
- },
67
- },
68
51
},
69
52
errMessage : "api-server resource not found installing VerticalPodAutoscaler my.thing: GroupVersionKind " +
70
53
"verticalpodautoscalers.autoscaling.k8s.io/v1, Kind=VerticalPodAutoscaler not found on the cluster" ,
71
54
}),
72
55
}
73
56
74
57
table .DescribeTable ("the ip enters a failed state with a helpful error message" , func (tt payload ) {
75
- Expect (ctx .Ctx ().Client ().Create (context .Background (), tt .ip )).To (Succeed ())
76
- Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), tt .ip )).To (Succeed ())
58
+ Expect (ctx .Ctx ().Client ().Create (context .Background (), tt .IP )).To (Succeed ())
59
+
60
+ tt .IP .Status = operatorsv1alpha1.InstallPlanStatus {
61
+ Phase : operatorsv1alpha1 .InstallPlanPhaseInstalling ,
62
+ CatalogSources : []string {},
63
+ Plan : []* operatorsv1alpha1.Step {
64
+ {
65
+ Resolving : "test-csv" ,
66
+ Status : operatorsv1alpha1 .StepStatusUnknown ,
67
+ Resource : operatorsv1alpha1.StepResource {
68
+ Name : "my.thing" ,
69
+ Group : "verticalpodautoscalers.autoscaling.k8s.io" ,
70
+ Version : "v1" ,
71
+ Kind : "VerticalPodAutoscaler" ,
72
+ Manifest : missingAPI ,
73
+ },
74
+ },
75
+ },
76
+ }
77
+
78
+ Expect (ctx .Ctx ().Client ().Status ().Update (context .Background (), tt .IP )).To (Succeed (), "failed to update the resource" )
77
79
78
80
// The IP sits in the Installing phase with the GVK missing error
79
81
Eventually (func () (* operatorsv1alpha1.InstallPlan , error ) {
80
- return tt .ip , ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (tt .ip ), tt .ip )
82
+ return tt .IP , ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (tt .IP ), tt .IP )
81
83
}).Should (And (HavePhase (operatorsv1alpha1 .InstallPlanPhaseInstalling )), HaveMessage (tt .errMessage ))
82
84
83
85
// Eventually the IP fails with the GVK missing error, after installplan retries, which is by default 1 minute.
84
86
Eventually (func () (* operatorsv1alpha1.InstallPlan , error ) {
85
- return tt .ip , ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (tt .ip ), tt .ip )
87
+ return tt .IP , ctx .Ctx ().Client ().Get (context .Background (), client .ObjectKeyFromObject (tt .IP ), tt .IP )
86
88
}, 2 * time .Minute ).Should (And (HavePhase (operatorsv1alpha1 .InstallPlanPhaseFailed )), HaveMessage (tt .errMessage ))
87
89
}, tableEntries ... )
88
90
})
0 commit comments