Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
26366255
Commit
26366255
authored
May 24, 2019
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apiextensions: run conversion tests also with preserveUnknownFields=false
parent
d87de1a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
conversion_test.go
...-apiserver/test/integration/conversion/conversion_test.go
+70
-0
No files found.
staging/src/k8s.io/apiextensions-apiserver/test/integration/conversion/conversion_test.go
View file @
26366255
...
@@ -45,6 +45,7 @@ import (
...
@@ -45,6 +45,7 @@ import (
utilfeature
"k8s.io/apiserver/pkg/util/feature"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/dynamic"
featuregatetesting
"k8s.io/component-base/featuregate/testing"
featuregatetesting
"k8s.io/component-base/featuregate/testing"
"k8s.io/utils/pointer"
apiextensionsv1beta1
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
apiextensionsv1beta1
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
...
@@ -58,6 +59,14 @@ func checks(checkers ...Checker) []Checker {
...
@@ -58,6 +59,14 @@ func checks(checkers ...Checker) []Checker {
}
}
func
TestWebhookConverter
(
t
*
testing
.
T
)
{
func
TestWebhookConverter
(
t
*
testing
.
T
)
{
testWebhookConverter
(
t
,
false
)
}
func
TestWebhookConverterWithPruning
(
t
*
testing
.
T
)
{
testWebhookConverter
(
t
,
true
)
}
func
testWebhookConverter
(
t
*
testing
.
T
,
pruning
bool
)
{
tests
:=
[]
struct
{
tests
:=
[]
struct
{
group
string
group
string
handler
http
.
Handler
handler
http
.
Handler
...
@@ -111,6 +120,7 @@ func TestWebhookConverter(t *testing.T) {
...
@@ -111,6 +120,7 @@ func TestWebhookConverter(t *testing.T) {
defer
tearDown
()
defer
tearDown
()
crd
:=
multiVersionFixture
.
DeepCopy
()
crd
:=
multiVersionFixture
.
DeepCopy
()
crd
.
Spec
.
PreserveUnknownFields
=
pointer
.
BoolPtr
(
!
pruning
)
RESTOptionsGetter
:=
serveroptions
.
NewCRDRESTOptionsGetter
(
*
options
.
RecommendedOptions
.
Etcd
)
RESTOptionsGetter
:=
serveroptions
.
NewCRDRESTOptionsGetter
(
*
options
.
RecommendedOptions
.
Etcd
)
restOptions
,
err
:=
RESTOptionsGetter
.
GetRESTOptions
(
schema
.
GroupResource
{
Group
:
crd
.
Spec
.
Group
,
Resource
:
crd
.
Spec
.
Names
.
Plural
})
restOptions
,
err
:=
RESTOptionsGetter
.
GetRESTOptions
(
schema
.
GroupResource
{
Group
:
crd
.
Spec
.
Group
,
Resource
:
crd
.
Spec
.
Names
.
Plural
})
...
@@ -616,18 +626,78 @@ var multiVersionFixture = &apiextensionsv1beta1.CustomResourceDefinition{
...
@@ -616,18 +626,78 @@ var multiVersionFixture = &apiextensionsv1beta1.CustomResourceDefinition{
Name
:
"v1beta1"
,
Name
:
"v1beta1"
,
Served
:
true
,
Served
:
true
,
Storage
:
true
,
Storage
:
true
,
Schema
:
&
apiextensionsv1beta1
.
CustomResourceValidation
{
OpenAPIV3Schema
:
&
apiextensionsv1beta1
.
JSONSchemaProps
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"content"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"key"
:
{
Type
:
"string"
},
},
},
"num"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"num1"
:
{
Type
:
"integer"
},
"num2"
:
{
Type
:
"integer"
},
},
},
},
},
},
},
},
{
{
// same schema as v1beta1
// same schema as v1beta1
Name
:
"v1alpha1"
,
Name
:
"v1alpha1"
,
Served
:
true
,
Served
:
true
,
Storage
:
false
,
Storage
:
false
,
Schema
:
&
apiextensionsv1beta1
.
CustomResourceValidation
{
OpenAPIV3Schema
:
&
apiextensionsv1beta1
.
JSONSchemaProps
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"content"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"key"
:
{
Type
:
"string"
},
},
},
"num"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"num1"
:
{
Type
:
"integer"
},
"num2"
:
{
Type
:
"integer"
},
},
},
},
},
},
},
},
{
{
// different schema than v1beta1 and v1alpha1
// different schema than v1beta1 and v1alpha1
Name
:
"v1beta2"
,
Name
:
"v1beta2"
,
Served
:
true
,
Served
:
true
,
Storage
:
false
,
Storage
:
false
,
Schema
:
&
apiextensionsv1beta1
.
CustomResourceValidation
{
OpenAPIV3Schema
:
&
apiextensionsv1beta1
.
JSONSchemaProps
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"contentv2"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"key"
:
{
Type
:
"string"
},
},
},
"numv2"
:
{
Type
:
"object"
,
Properties
:
map
[
string
]
apiextensionsv1beta1
.
JSONSchemaProps
{
"num1"
:
{
Type
:
"integer"
},
"num2"
:
{
Type
:
"integer"
},
},
},
},
},
},
},
},
},
},
Subresources
:
&
apiextensionsv1beta1
.
CustomResourceSubresources
{
Subresources
:
&
apiextensionsv1beta1
.
CustomResourceSubresources
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment