@@ -10,7 +10,7 @@ import (
1010 "testing"
1111
1212 "github.com/stretchr/testify/assert"
13- v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
13+ apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1414
1515 "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/preflights/crdupgradesafety"
1616)
@@ -26,42 +26,42 @@ func TestCalculateFlatSchemaDiff(t *testing.T) {
2626 {
2727 name : "no diff in schemas, empty diff, no error" ,
2828 old : crdupgradesafety.FlatSchema {
29- "foo" : & v1 .JSONSchemaProps {},
29+ "foo" : & apiextensionsv1 .JSONSchemaProps {},
3030 },
3131 new : crdupgradesafety.FlatSchema {
32- "foo" : & v1 .JSONSchemaProps {},
32+ "foo" : & apiextensionsv1 .JSONSchemaProps {},
3333 },
3434 expectedDiff : map [string ]crdupgradesafety.FieldDiff {},
3535 },
3636 {
3737 name : "diff in schemas, diff returned, no error" ,
3838 old : crdupgradesafety.FlatSchema {
39- "foo" : & v1 .JSONSchemaProps {},
39+ "foo" : & apiextensionsv1 .JSONSchemaProps {},
4040 },
4141 new : crdupgradesafety.FlatSchema {
42- "foo" : & v1 .JSONSchemaProps {
42+ "foo" : & apiextensionsv1 .JSONSchemaProps {
4343 ID : "bar" ,
4444 },
4545 },
4646 expectedDiff : map [string ]crdupgradesafety.FieldDiff {
4747 "foo" : {
48- Old : & v1 .JSONSchemaProps {},
49- New : & v1 .JSONSchemaProps {ID : "bar" },
48+ Old : & apiextensionsv1 .JSONSchemaProps {},
49+ New : & apiextensionsv1 .JSONSchemaProps {ID : "bar" },
5050 },
5151 },
5252 },
5353 {
5454 name : "diff in child properties only, no diff returned, no error" ,
5555 old : crdupgradesafety.FlatSchema {
56- "foo" : & v1 .JSONSchemaProps {
57- Properties : map [string ]v1 .JSONSchemaProps {
56+ "foo" : & apiextensionsv1 .JSONSchemaProps {
57+ Properties : map [string ]apiextensionsv1 .JSONSchemaProps {
5858 "bar" : {ID : "bar" },
5959 },
6060 },
6161 },
6262 new : crdupgradesafety.FlatSchema {
63- "foo" : & v1 .JSONSchemaProps {
64- Properties : map [string ]v1 .JSONSchemaProps {
63+ "foo" : & apiextensionsv1 .JSONSchemaProps {
64+ Properties : map [string ]apiextensionsv1 .JSONSchemaProps {
6565 "bar" : {ID : "baz" },
6666 },
6767 },
@@ -71,10 +71,10 @@ func TestCalculateFlatSchemaDiff(t *testing.T) {
7171 {
7272 name : "field exists in old but not new, no diff returned, error" ,
7373 old : crdupgradesafety.FlatSchema {
74- "foo" : & v1 .JSONSchemaProps {},
74+ "foo" : & apiextensionsv1 .JSONSchemaProps {},
7575 },
7676 new : crdupgradesafety.FlatSchema {
77- "bar" : & v1 .JSONSchemaProps {},
77+ "bar" : & apiextensionsv1 .JSONSchemaProps {},
7878 },
7979 expectedDiff : map [string ]crdupgradesafety.FieldDiff {},
8080 shouldError : true ,
@@ -89,10 +89,10 @@ func TestCalculateFlatSchemaDiff(t *testing.T) {
8989}
9090
9191func TestFlattenSchema (t * testing.T ) {
92- schema := & v1 .JSONSchemaProps {
93- Properties : map [string ]v1 .JSONSchemaProps {
92+ schema := & apiextensionsv1 .JSONSchemaProps {
93+ Properties : map [string ]apiextensionsv1 .JSONSchemaProps {
9494 "foo" : {
95- Properties : map [string ]v1 .JSONSchemaProps {
95+ Properties : map [string ]apiextensionsv1 .JSONSchemaProps {
9696 "bar" : {},
9797 },
9898 },
@@ -119,8 +119,8 @@ func TestChangeValidator(t *testing.T) {
119119 for _ , tc := range []struct {
120120 name string
121121 changeValidator * crdupgradesafety.ChangeValidator
122- old v1 .CustomResourceDefinition
123- new v1 .CustomResourceDefinition
122+ old apiextensionsv1 .CustomResourceDefinition
123+ new apiextensionsv1 .CustomResourceDefinition
124124 shouldError bool
125125 }{
126126 {
@@ -132,25 +132,25 @@ func TestChangeValidator(t *testing.T) {
132132 },
133133 },
134134 },
135- old : v1 .CustomResourceDefinition {
136- Spec : v1 .CustomResourceDefinitionSpec {
137- Versions : []v1 .CustomResourceDefinitionVersion {
135+ old : apiextensionsv1 .CustomResourceDefinition {
136+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
137+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
138138 {
139139 Name : "v1alpha1" ,
140- Schema : & v1 .CustomResourceValidation {
141- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
140+ Schema : & apiextensionsv1 .CustomResourceValidation {
141+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
142142 },
143143 },
144144 },
145145 },
146146 },
147- new : v1 .CustomResourceDefinition {
148- Spec : v1 .CustomResourceDefinitionSpec {
149- Versions : []v1 .CustomResourceDefinitionVersion {
147+ new : apiextensionsv1 .CustomResourceDefinition {
148+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
149+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
150150 {
151151 Name : "v1alpha1" ,
152- Schema : & v1 .CustomResourceValidation {
153- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
152+ Schema : & apiextensionsv1 .CustomResourceValidation {
153+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
154154 },
155155 },
156156 },
@@ -166,25 +166,25 @@ func TestChangeValidator(t *testing.T) {
166166 },
167167 },
168168 },
169- old : v1 .CustomResourceDefinition {
170- Spec : v1 .CustomResourceDefinitionSpec {
171- Versions : []v1 .CustomResourceDefinitionVersion {
169+ old : apiextensionsv1 .CustomResourceDefinition {
170+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
171+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
172172 {
173173 Name : "v1alpha1" ,
174- Schema : & v1 .CustomResourceValidation {
175- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
174+ Schema : & apiextensionsv1 .CustomResourceValidation {
175+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
176176 },
177177 },
178178 },
179179 },
180180 },
181- new : v1 .CustomResourceDefinition {
182- Spec : v1 .CustomResourceDefinitionSpec {
183- Versions : []v1 .CustomResourceDefinitionVersion {
181+ new : apiextensionsv1 .CustomResourceDefinition {
182+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
183+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
184184 {
185185 Name : "v1alpha1" ,
186- Schema : & v1 .CustomResourceValidation {
187- OpenAPIV3Schema : & v1 .JSONSchemaProps {
186+ Schema : & apiextensionsv1 .CustomResourceValidation {
187+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {
188188 ID : "foo" ,
189189 },
190190 },
@@ -202,25 +202,25 @@ func TestChangeValidator(t *testing.T) {
202202 },
203203 },
204204 },
205- old : v1 .CustomResourceDefinition {
206- Spec : v1 .CustomResourceDefinitionSpec {
207- Versions : []v1 .CustomResourceDefinitionVersion {
205+ old : apiextensionsv1 .CustomResourceDefinition {
206+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
207+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
208208 {
209209 Name : "v1alpha1" ,
210- Schema : & v1 .CustomResourceValidation {
211- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
210+ Schema : & apiextensionsv1 .CustomResourceValidation {
211+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
212212 },
213213 },
214214 },
215215 },
216216 },
217- new : v1 .CustomResourceDefinition {
218- Spec : v1 .CustomResourceDefinitionSpec {
219- Versions : []v1 .CustomResourceDefinitionVersion {
217+ new : apiextensionsv1 .CustomResourceDefinition {
218+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
219+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
220220 {
221221 Name : "v1alpha1" ,
222- Schema : & v1 .CustomResourceValidation {
223- OpenAPIV3Schema : & v1 .JSONSchemaProps {
222+ Schema : & apiextensionsv1 .CustomResourceValidation {
223+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {
224224 ID : "foo" ,
225225 },
226226 },
@@ -239,25 +239,25 @@ func TestChangeValidator(t *testing.T) {
239239 },
240240 },
241241 },
242- old : v1 .CustomResourceDefinition {
243- Spec : v1 .CustomResourceDefinitionSpec {
244- Versions : []v1 .CustomResourceDefinitionVersion {
242+ old : apiextensionsv1 .CustomResourceDefinition {
243+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
244+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
245245 {
246246 Name : "v1alpha1" ,
247- Schema : & v1 .CustomResourceValidation {
248- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
247+ Schema : & apiextensionsv1 .CustomResourceValidation {
248+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
249249 },
250250 },
251251 },
252252 },
253253 },
254- new : v1 .CustomResourceDefinition {
255- Spec : v1 .CustomResourceDefinitionSpec {
256- Versions : []v1 .CustomResourceDefinitionVersion {
254+ new : apiextensionsv1 .CustomResourceDefinition {
255+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
256+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
257257 {
258258 Name : "v1alpha1" ,
259- Schema : & v1 .CustomResourceValidation {
260- OpenAPIV3Schema : & v1 .JSONSchemaProps {
259+ Schema : & apiextensionsv1 .CustomResourceValidation {
260+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {
261261 ID : "foo" ,
262262 },
263263 },
@@ -276,25 +276,25 @@ func TestChangeValidator(t *testing.T) {
276276 },
277277 },
278278 },
279- old : v1 .CustomResourceDefinition {
280- Spec : v1 .CustomResourceDefinitionSpec {
281- Versions : []v1 .CustomResourceDefinitionVersion {
279+ old : apiextensionsv1 .CustomResourceDefinition {
280+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
281+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
282282 {
283283 Name : "v1alpha1" ,
284- Schema : & v1 .CustomResourceValidation {
285- OpenAPIV3Schema : & v1 .JSONSchemaProps {},
284+ Schema : & apiextensionsv1 .CustomResourceValidation {
285+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {},
286286 },
287287 },
288288 },
289289 },
290290 },
291- new : v1 .CustomResourceDefinition {
292- Spec : v1 .CustomResourceDefinitionSpec {
293- Versions : []v1 .CustomResourceDefinitionVersion {
291+ new : apiextensionsv1 .CustomResourceDefinition {
292+ Spec : apiextensionsv1 .CustomResourceDefinitionSpec {
293+ Versions : []apiextensionsv1 .CustomResourceDefinitionVersion {
294294 {
295295 Name : "v1alpha1" ,
296- Schema : & v1 .CustomResourceValidation {
297- OpenAPIV3Schema : & v1 .JSONSchemaProps {
296+ Schema : & apiextensionsv1 .CustomResourceValidation {
297+ OpenAPIV3Schema : & apiextensionsv1 .JSONSchemaProps {
298298 ID : "foo" ,
299299 },
300300 },
0 commit comments