@@ -63,43 +63,63 @@ func TestReconcile(t *testing.T) {
63
63
crdObjectKey := client.ObjectKey {Name : crdName }
64
64
65
65
tests := []struct {
66
- name string
67
- skipCRDMigrationPhases []Phase
68
- useCache bool
66
+ name string
67
+ skipCRDMigrationPhases []Phase
68
+ useCache bool
69
+ useStatusForStorageVersionMigration bool
69
70
}{
70
71
{
71
- name : "run both StorageVersionMigration and CleanupManagedFields with cache" ,
72
- skipCRDMigrationPhases : nil ,
73
- useCache : true ,
72
+ name : "run both StorageVersionMigration and CleanupManagedFields with cache" ,
73
+ skipCRDMigrationPhases : nil ,
74
+ useCache : true ,
75
+ useStatusForStorageVersionMigration : false ,
74
76
},
75
77
{
76
- name : "run both StorageVersionMigration and CleanupManagedFields without cache" ,
77
- skipCRDMigrationPhases : nil ,
78
- useCache : false ,
78
+ name : "run both StorageVersionMigration and CleanupManagedFields without cache" ,
79
+ skipCRDMigrationPhases : nil ,
80
+ useCache : false ,
81
+ useStatusForStorageVersionMigration : false ,
79
82
},
80
83
{
81
- name : "run only CleanupManagedFields with cache" ,
82
- skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase },
83
- useCache : true ,
84
+ name : "run both StorageVersionMigration and CleanupManagedFields with cache (using status)" ,
85
+ skipCRDMigrationPhases : nil ,
86
+ useCache : true ,
87
+ useStatusForStorageVersionMigration : true ,
84
88
},
85
89
{
86
- name : "run only CleanupManagedFields without cache" ,
87
- skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase },
88
- useCache : false ,
90
+ name : "run both StorageVersionMigration and CleanupManagedFields without cache (using status)" ,
91
+ skipCRDMigrationPhases : nil ,
92
+ useCache : false ,
93
+ useStatusForStorageVersionMigration : true ,
89
94
},
90
95
{
91
- name : "run only StorageVersionMigration with cache" ,
92
- skipCRDMigrationPhases : []Phase {CleanupManagedFieldsPhase },
93
- useCache : true ,
96
+ name : "run only CleanupManagedFields with cache" ,
97
+ skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase },
98
+ useCache : true ,
99
+ useStatusForStorageVersionMigration : false ,
94
100
},
95
101
{
96
- name : "run only StorageVersionMigration without cache" ,
97
- skipCRDMigrationPhases : []Phase {CleanupManagedFieldsPhase },
98
- useCache : false ,
102
+ name : "run only CleanupManagedFields without cache" ,
103
+ skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase },
104
+ useCache : false ,
105
+ useStatusForStorageVersionMigration : false ,
99
106
},
100
107
{
101
- name : "skip all" ,
102
- skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase , CleanupManagedFieldsPhase },
108
+ name : "run only StorageVersionMigration with cache" ,
109
+ skipCRDMigrationPhases : []Phase {CleanupManagedFieldsPhase },
110
+ useCache : true ,
111
+ useStatusForStorageVersionMigration : false ,
112
+ },
113
+ {
114
+ name : "run only StorageVersionMigration without cache" ,
115
+ skipCRDMigrationPhases : []Phase {CleanupManagedFieldsPhase },
116
+ useCache : false ,
117
+ useStatusForStorageVersionMigration : false ,
118
+ },
119
+ {
120
+ name : "skip all" ,
121
+ skipCRDMigrationPhases : []Phase {StorageVersionMigrationPhase , CleanupManagedFieldsPhase },
122
+ useStatusForStorageVersionMigration : false ,
103
123
},
104
124
}
105
125
for _ , tt := range tests {
@@ -127,19 +147,19 @@ func TestReconcile(t *testing.T) {
127
147
// Create manager for all steps.
128
148
skipCRDMigrationPhases := sets.Set [Phase ]{}.Insert (tt .skipCRDMigrationPhases ... )
129
149
managerT1 , err := createManagerWithCRDMigrator (tt .skipCRDMigrationPhases , map [client.Object ]ByObjectConfig {
130
- & t1v1beta1.TestCluster {}: {UseCache : tt .useCache },
150
+ & t1v1beta1.TestCluster {}: {UseCache : tt .useCache , UseStatusForStorageVersionMigration : tt . useStatusForStorageVersionMigration },
131
151
}, t1v1beta1 .AddToScheme )
132
152
g .Expect (err ).ToNot (HaveOccurred ())
133
153
managerT2 , err := createManagerWithCRDMigrator (tt .skipCRDMigrationPhases , map [client.Object ]ByObjectConfig {
134
- & t2v1beta2.TestCluster {}: {UseCache : tt .useCache },
154
+ & t2v1beta2.TestCluster {}: {UseCache : tt .useCache , UseStatusForStorageVersionMigration : tt . useStatusForStorageVersionMigration },
135
155
}, t2v1beta2 .AddToScheme )
136
156
g .Expect (err ).ToNot (HaveOccurred ())
137
157
managerT3 , err := createManagerWithCRDMigrator (tt .skipCRDMigrationPhases , map [client.Object ]ByObjectConfig {
138
- & t3v1beta2.TestCluster {}: {UseCache : tt .useCache },
158
+ & t3v1beta2.TestCluster {}: {UseCache : tt .useCache , UseStatusForStorageVersionMigration : tt . useStatusForStorageVersionMigration },
139
159
}, t3v1beta2 .AddToScheme )
140
160
g .Expect (err ).ToNot (HaveOccurred ())
141
161
managerT4 , err := createManagerWithCRDMigrator (tt .skipCRDMigrationPhases , map [client.Object ]ByObjectConfig {
142
- & t4v1beta2.TestCluster {}: {UseCache : tt .useCache },
162
+ & t4v1beta2.TestCluster {}: {UseCache : tt .useCache , UseStatusForStorageVersionMigration : tt . useStatusForStorageVersionMigration },
143
163
}, t4v1beta2 .AddToScheme )
144
164
g .Expect (err ).ToNot (HaveOccurred ())
145
165
0 commit comments