|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Copyright 2019 The Kubernetes Authors All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +# This script executes the Kubernetes conformance tests in accordance with: |
| 18 | +# https://github.com/cncf/k8s-conformance/blob/master/instructions.md |
| 19 | +# |
| 20 | +# Usage: |
| 21 | +# conformance_tests.sh <path to minikube> <flags> |
| 22 | +# |
| 23 | +# Example: |
| 24 | +# conformance_tests.sh ./out/minikube --vm-driver=hyperkit |
| 25 | +set -ex -o pipefail |
| 26 | + |
| 27 | +readonly PROFILE_NAME="k8sconformance" |
| 28 | +readonly MINIKUBE=${1:-./out/minikube} |
| 29 | +shift || true |
| 30 | +readonly START_ARGS=$* |
| 31 | + |
| 32 | +# Requires a fully running Kubernetes cluster. |
| 33 | +"${MINIKUBE}" delete -p "${PROFILE_NAME}" || true |
| 34 | +"${MINIKUBE}" start -p "${PROFILE_NAME}" $START_ARGS |
| 35 | +"${MINIKUBE}" status -p "${PROFILE_NAME}" |
| 36 | +kubectl get pods --all-namespaces |
| 37 | + |
| 38 | +go get -u -v github.com/heptio/sonobuoy |
| 39 | +sonobuoy run --wait |
| 40 | +outdir="$(mktemp -d)" |
| 41 | +sonobuoy retrieve "${outdir}" |
| 42 | + |
| 43 | +cwd=$(pwd) |
| 44 | + |
| 45 | +cd "${outdir}" |
| 46 | +mkdir ./results; tar xzf *.tar.gz -C ./results |
| 47 | + |
| 48 | +version=$(${MINIKUBE} version | cut -d" " -f3) |
| 49 | + |
| 50 | +mkdir minikube-${version} |
| 51 | +cd minikube-${version} |
| 52 | + |
| 53 | +cat <<EOF >PRODUCT.yaml |
| 54 | +vendor: minikube |
| 55 | +name: minikube |
| 56 | +version: ${version} |
| 57 | +website_url: https://github.com/kubernetes/minikube |
| 58 | +repo_url: https://github.com/kubernetes/minikube |
| 59 | +documentation_url: https://github.com/kubernetes/minikube/blob/master/docs/README.md |
| 60 | +product_logo_url: https://raw.githubusercontent.com/kubernetes/minikube/master/images/logo/logo.svg |
| 61 | +type: installer |
| 62 | +description: minikube runs a local Kubernetes cluster on macOS, Linux, and Windows. |
| 63 | +EOF |
| 64 | + |
| 65 | +cat <<EOF >README.md |
| 66 | +./hack/conformance_tests.sh $MINIKUBE $START_ARGS |
| 67 | +EOF |
| 68 | + |
| 69 | +cp ../results/plugins/e2e/results/* . |
| 70 | +cd .. |
| 71 | +cp -r minikube-${version} ${cwd} |
0 commit comments