mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
tweaking integration test
This commit is contained in:
@@ -15,9 +15,16 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
# This script run periodically by kubernetes test-infra.
|
# This script is run periodically by kubernetes test-infra.
|
||||||
# At time of writing, it's 'call point' was in
|
#
|
||||||
|
# It's meant to use kustomized configurations against a live cluster.
|
||||||
|
#
|
||||||
|
# At time of writing, its 'call point' was in
|
||||||
# https://github.com/kubernetes/test-infra/blob/master/jobs/config.json
|
# https://github.com/kubernetes/test-infra/blob/master/jobs/config.json
|
||||||
|
#
|
||||||
|
# The script is written to assume that the process running it
|
||||||
|
# has checked out kubernetes-sigs/kustomize repo, and has
|
||||||
|
# changed the current directory to
|
||||||
|
|
||||||
function exit_with {
|
function exit_with {
|
||||||
local msg=$1
|
local msg=$1
|
||||||
@@ -25,15 +32,22 @@ function exit_with {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
base_dir="$( cd "$(dirname "$0")/../../.." && pwd )"
|
repo=kubernetes-sigs/kustomize
|
||||||
cd "$base_dir" || {
|
if [[ `pwd` != */$repo ]]; then
|
||||||
exit_with "Cannot cd to ${base_dir}. Aborting."
|
exit_with "Script must be run from $repo"
|
||||||
}
|
fi
|
||||||
|
|
||||||
|
go install . || \
|
||||||
|
{ exit_with "Failed to install kustomize."; }
|
||||||
|
|
||||||
go install github.com/kubernetes-sigs/kustomize || \
|
|
||||||
{ exit_with "Failed to install kustomize"; }
|
|
||||||
export PATH=$GOPATH/bin:$PATH
|
export PATH=$GOPATH/bin:$PATH
|
||||||
|
|
||||||
|
command -v kustomize >/dev/null 2>&1 || \
|
||||||
|
{ exit_with "Require kustomize but it's not installed."; }
|
||||||
|
|
||||||
|
command -v kubectl >/dev/null 2>&1 || \
|
||||||
|
{ exit_with "Require kubectl but it's not installed."; }
|
||||||
|
|
||||||
function runTest {
|
function runTest {
|
||||||
local script=$1
|
local script=$1
|
||||||
shift
|
shift
|
||||||
@@ -50,4 +64,6 @@ function runTest {
|
|||||||
echo "$script passed."
|
echo "$script passed."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pushd demos
|
||||||
runTest ldap/integration_test.sh ldap/base
|
runTest ldap/integration_test.sh ldap/base
|
||||||
|
popd
|
||||||
|
|||||||
@@ -28,28 +28,23 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
function exit_with {
|
target=$1
|
||||||
local msg=$1
|
|
||||||
echo >&2 ${msg}
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# make sure kustomize and kubectl are available
|
echo pwd is `pwd`
|
||||||
command -v kustomize >/dev/null 2>&1 || \
|
echo Kustomizing \"$target\"
|
||||||
{ exit_with "Require kustomize but it's not installed. Aborting."; }
|
ls $target
|
||||||
command -v kubectl >/dev/null 2>&1 || \
|
kustomize build $target > generatedResources.yaml
|
||||||
{ exit_with "Require kubectl but it's not installed. Aborting."; }
|
|
||||||
|
|
||||||
# set namespace to default
|
|
||||||
kubectl config set-context $(kubectl config current-context) --namespace=default
|
|
||||||
|
|
||||||
echo Kustomizing \"$1\"
|
|
||||||
ls $1
|
|
||||||
kustomize build $1 > generatedResources.yaml
|
|
||||||
[[ $? -eq 0 ]] || { exit_with "Failed to kustomize build"; }
|
[[ $? -eq 0 ]] || { exit_with "Failed to kustomize build"; }
|
||||||
|
|
||||||
cat generatedResources.yaml
|
cat generatedResources.yaml
|
||||||
|
|
||||||
|
# Setting the namespace this way is a test-infra thing?
|
||||||
|
kubectl config set-context \
|
||||||
|
$(kubectl config current-context) --namespace=default
|
||||||
|
|
||||||
kubectl apply -f generatedResources.yaml
|
kubectl apply -f generatedResources.yaml
|
||||||
[[ $? -eq 0 ]] || { exit_with "Failed to run kubectl apply"; }
|
[[ $? -eq 0 ]] || { exit_with "Failed to run kubectl apply"; }
|
||||||
|
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
# get the pod and namespace
|
# get the pod and namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user