mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
port conformance yaml generation to hack
This commit is contained in:
parent
a7fe0bf8e5
commit
c1c3fdefe3
27
hack/update-conformance-yaml.sh
Executable file
27
hack/update-conformance-yaml.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# generate json spec -> yaml
|
||||||
|
test/conformance/gen-conformance-yaml.sh
|
||||||
|
# replace checked-in yaml
|
||||||
|
cp _output/conformance.yaml test/conformance/testdata/conformance.yaml
|
33
hack/verify-conformance-yaml.sh
Executable file
33
hack/verify-conformance-yaml.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# generate json spec -> yaml
|
||||||
|
test/conformance/gen-conformance-yaml.sh
|
||||||
|
|
||||||
|
# diff generated and checked-in
|
||||||
|
if diff -u test/conformance/testdata/conformance.yaml _output/conformance.yaml; then
|
||||||
|
echo PASS
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo 'See instructions in test/conformance/README.md'
|
||||||
|
exit 1
|
@ -5,11 +5,6 @@ If you add or remove a conformance test, this test will fail and you will need
|
|||||||
to update the golden list of tests stored in `testdata/`. Changes to that file
|
to update the golden list of tests stored in `testdata/`. Changes to that file
|
||||||
require review by sig-architecture.
|
require review by sig-architecture.
|
||||||
|
|
||||||
To update the list, run
|
To update the list, run `hack/update-conformance-yaml.sh`
|
||||||
|
|
||||||
```console
|
|
||||||
bazel build //test/conformance:list_conformance_tests
|
|
||||||
cp bazel-bin/test/conformance/conformance.yaml test/conformance/testdata
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the changed file to your PR, then send for review.
|
Add the changed file to your PR, then send for review.
|
||||||
|
28
test/conformance/gen-conformance-yaml.sh
Executable file
28
test/conformance/gen-conformance-yaml.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# This will canonicalize the path
|
||||||
|
KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# test sources -> json spec _output/specsummaries.json
|
||||||
|
test/conformance/gen-specsummaries.sh
|
||||||
|
# specsummaries.json -> conformance.yaml
|
||||||
|
test/conformance/spec-to-yaml.sh
|
29
test/conformance/gen-specsummaries.sh
Executable file
29
test/conformance/gen-specsummaries.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# This will canonicalize the path
|
||||||
|
KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# build ginkgo and e2e.test
|
||||||
|
make WHAT='vendor/github.com/onsi/ginkgo/ginkgo test/e2e/e2e.test'
|
||||||
|
|
||||||
|
# dump spec
|
||||||
|
./_output/bin/ginkgo --dryRun=true --focus='[Conformance]' ./_output/bin/e2e.test -- --spec-dump "${KUBE_ROOT}/_output/specsummaries.json" > /dev/null
|
26
test/conformance/spec-to-yaml.sh
Executable file
26
test/conformance/spec-to-yaml.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# This will canonicalize the path
|
||||||
|
KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
# convert dumped spec (see dump-spec.sh) to conformance.yaml
|
||||||
|
go run ./test/conformance/walk.go --source="${KUBE_ROOT}" ./_output/specsummaries.json > ./_output/conformance.yaml
|
Loading…
Reference in New Issue
Block a user