mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
separate custom openapi test from the others
This commit is contained in:
3
Makefile
3
Makefile
@@ -229,7 +229,8 @@ generate-kustomize-api: $(MYGOBIN)/k8scopy
|
||||
|
||||
.PHONY: test-unit-kustomize-api
|
||||
test-unit-kustomize-api: build-kustomize-api
|
||||
cd api; go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222"
|
||||
cd api; go test ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222"; \
|
||||
cd krusty; OPENAPI_TEST=true go test -run TestCustomOpenAPIFieldFromComponentWithOverlays
|
||||
|
||||
.PHONY: test-unit-kustomize-plugins
|
||||
test-unit-kustomize-plugins:
|
||||
|
||||
@@ -5,6 +5,7 @@ package krusty_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -350,6 +351,10 @@ func TestCustomOpenAPIFieldFromComponent(t *testing.T) {
|
||||
// test for https://github.com/kubernetes-sigs/kustomize/issues/4179
|
||||
// kustomize is not seeing the openapi field from the component defined in the overlay
|
||||
func TestCustomOpenAPIFieldFromComponentWithOverlays(t *testing.T) {
|
||||
if val, ok := os.LookupEnv("OPENAPI_TEST"); !ok || val != "true" {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
|
||||
// overlay declaring the component
|
||||
|
||||
22026
api/krusty/testdata/openshiftschema.json
vendored
22026
api/krusty/testdata/openshiftschema.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -547,9 +547,6 @@ func SetSchema(openAPIField map[string]string, schema []byte, reset bool) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// if the schema is changed, initSchema should parse the new schema
|
||||
defer func() { globalSchema.schemaInit = false }()
|
||||
|
||||
version, exists := openAPIField["version"]
|
||||
if exists && schema != nil {
|
||||
return fmt.Errorf("builtin version and custom schema provided, cannot use both")
|
||||
@@ -558,6 +555,8 @@ func SetSchema(openAPIField map[string]string, schema []byte, reset bool) error
|
||||
if schema != nil { // use custom schema
|
||||
customSchema = schema
|
||||
kubernetesOpenAPIVersion = "custom"
|
||||
// if the schema is changed, initSchema should parse the new schema
|
||||
globalSchema.schemaInit = false
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -570,6 +569,8 @@ func SetSchema(openAPIField map[string]string, schema []byte, reset bool) error
|
||||
return fmt.Errorf("the specified OpenAPI version is not built in")
|
||||
}
|
||||
customSchema = nil
|
||||
// if the schema is changed, initSchema should parse the new schema
|
||||
globalSchema.schemaInit = false
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user