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
629bdf5e
Commit
629bdf5e
authored
May 22, 2019
by
Haowei Cai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore test behavior for CRD without validation cases
the test doesn't set empty validation but expects CRD controller to treat nil schema specially and publish an empty schema
parent
1cfed1cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
crd_publish_openapi.go
test/e2e/apimachinery/crd_publish_openapi.go
+15
-8
No files found.
test/e2e/apimachinery/crd_publish_openapi.go
View file @
629bdf5e
...
...
@@ -341,12 +341,16 @@ func setupCRD(f *framework.Framework, schema []byte, groupSuffix string, version
return
nil
,
fmt
.
Errorf
(
"require at least one version for CRD"
)
}
if
schema
==
nil
{
schema
=
[]
byte
(
`type: object`
)
}
expect
:=
schema
props
:=
&
v1beta1
.
JSONSchemaProps
{}
if
err
:=
yaml
.
Unmarshal
(
schema
,
props
);
err
!=
nil
{
return
nil
,
err
if
schema
==
nil
{
// to be backwards compatible, we expect CRD controller to treat
// CRD with nil schema specially and publish an empty schema
expect
=
[]
byte
(
`type: object`
)
}
else
{
if
err
:=
yaml
.
Unmarshal
(
schema
,
props
);
err
!=
nil
{
return
nil
,
err
}
}
crd
,
err
:=
crd
.
CreateMultiVersionTestCRD
(
f
,
group
,
func
(
crd
*
v1beta1
.
CustomResourceDefinition
)
{
...
...
@@ -360,8 +364,11 @@ func setupCRD(f *framework.Framework, schema []byte, groupSuffix string, version
}
crd
.
Spec
.
Versions
=
apiVersions
crd
.
Spec
.
Validation
=
&
v1beta1
.
CustomResourceValidation
{
OpenAPIV3Schema
:
props
,
// set up validation when input schema isn't nil
if
schema
!=
nil
{
crd
.
Spec
.
Validation
=
&
v1beta1
.
CustomResourceValidation
{
OpenAPIV3Schema
:
props
,
}
}
})
if
err
!=
nil
{
...
...
@@ -369,7 +376,7 @@ func setupCRD(f *framework.Framework, schema []byte, groupSuffix string, version
}
for
_
,
v
:=
range
crd
.
Crd
.
Spec
.
Versions
{
if
err
:=
waitForDefinition
(
f
.
ClientSet
,
definitionName
(
crd
,
v
.
Name
),
schema
);
err
!=
nil
{
if
err
:=
waitForDefinition
(
f
.
ClientSet
,
definitionName
(
crd
,
v
.
Name
),
expect
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"%v"
,
err
)
}
}
...
...
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