@@ -12,6 +12,20 @@ import (
12
12
"k8s.io/kube-openapi/pkg/validation/spec"
13
13
)
14
14
15
+ type fakeClient struct {
16
+ paths map [string ]openapi.GroupVersion
17
+ }
18
+
19
+ func (f * fakeClient ) Paths () (map [string ]openapi.GroupVersion , error ) {
20
+ return f .paths , nil
21
+ }
22
+
23
+ type fakeErrClient struct {}
24
+
25
+ func (f * fakeErrClient ) Paths () (map [string ]openapi.GroupVersion , error ) {
26
+ return nil , errors .New ("fail Paths" )
27
+ }
28
+
15
29
// TestGetOpenAPISchemaKey tests the getOpenAPISchemaKey function. It checks if the
16
30
// function correctly formats the GroupVersionKind into the expected schema key format.
17
31
func TestGetOpenAPISchemaKey (t * testing.T ) {
@@ -90,20 +104,6 @@ func TestGetCRDGroupVersionKind(t *testing.T) {
90
104
}
91
105
}
92
106
93
- type fakeClient struct {
94
- paths map [string ]openapi.GroupVersion
95
- }
96
-
97
- func (f * fakeClient ) Paths () (map [string ]openapi.GroupVersion , error ) {
98
- return f .paths , nil
99
- }
100
-
101
- type fakeErrClient struct {}
102
-
103
- func (f * fakeErrClient ) Paths () (map [string ]openapi.GroupVersion , error ) {
104
- return nil , errors .New ("fail Paths" )
105
- }
106
-
107
107
// TestNewSchemaBuilder tests the NewSchemaBuilder function. It checks if the
108
108
// SchemaBuilder is correctly initialized with the expected number of schemas
109
109
// and the expected schema key.
@@ -155,9 +155,9 @@ func TestNewSchemaBuilder(t *testing.T) {
155
155
}
156
156
}
157
157
158
- // TestWithCRDCategories_AddsExtension tests the WithCRDCategories method
158
+ // TestWithCRDCategories tests the WithCRDCategories method
159
159
// for the SchemaBuilder struct. It checks if the categories are correctly added to the schema's extensions.
160
- func TestWithCRDCategories_AddsExtension (t * testing.T ) {
160
+ func TestWithCRDCategories (t * testing.T ) {
161
161
tests := []struct {
162
162
name string
163
163
key string
@@ -218,9 +218,9 @@ func TestWithCRDCategories_AddsExtension(t *testing.T) {
218
218
}
219
219
}
220
220
221
- // TestWithApiResourceCategories_AddsExtension tests the WithApiResourceCategories method
221
+ // TestWithApiResourceCategories tests the WithApiResourceCategories method
222
222
// for the SchemaBuilder struct. It checks if the categories are correctly added to the schema's extensions.
223
- func TestWithApiResourceCategories_AddsExtension (t * testing.T ) {
223
+ func TestWithApiResourceCategories (t * testing.T ) {
224
224
tests := []struct {
225
225
name string
226
226
key string
0 commit comments