forked from LaconicNetwork/kompose
Go mod (#1305)
* Use go mod instead of glide * Add `--with-kompose-annotation` flag to allow us to switch it off for tests * Remove hostpid support (since the newest sdk does not support it) * Create new test script and fixtures * Remove replicationcontroller support
This commit is contained in:
+12
-2
@@ -14,7 +14,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..)
|
||||
if type "greadlink" > /dev/null; then
|
||||
KOMPOSE_ROOT=$(greadlink -f $(dirname "${BASH_SOURCE}")/../../..)
|
||||
else
|
||||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..)
|
||||
fi
|
||||
|
||||
stat="stat"
|
||||
if type "gstat" > /dev/null; then
|
||||
stat="gstat"
|
||||
fi
|
||||
|
||||
source $KOMPOSE_ROOT/script/test/cmd/globals.sh
|
||||
|
||||
# setup all the things needed to run tests
|
||||
@@ -113,7 +123,7 @@ function convert::expect_success() {
|
||||
else convert::print_pass $SUCCESS_MSGS; fi
|
||||
|
||||
# check if no warnings are generated? If yes then fail
|
||||
warnings=$(stat -c%s $TEMP_STDERR)
|
||||
warnings=$($stat -c%s $TEMP_STDERR)
|
||||
if [ $warnings -ne 0 ]; then convert::print_fail "warnings given: $(cat $TEMP_STDERR)"; EXIT_STATUS=1; fi
|
||||
|
||||
convert::teardown
|
||||
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# 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 pe#rmissions and
|
||||
# limitations under the License.
|
||||
|
||||
# for mac
|
||||
if type "greadlink" > /dev/null; then
|
||||
KOMPOSE_ROOT=$(greadlink -f $(dirname "${BASH_SOURCE}")/../../..)
|
||||
else
|
||||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..)
|
||||
fi
|
||||
|
||||
source $KOMPOSE_ROOT/script/test/cmd/lib.sh
|
||||
|
||||
# Get current branch and remote url of git repository
|
||||
branch=$(git branch | grep \* | cut -d ' ' -f2-)
|
||||
|
||||
uri=$(git config --get remote.origin.url)
|
||||
if [[ $uri != *".git"* ]]; then
|
||||
uri="${uri}.git"
|
||||
fi
|
||||
|
||||
# Get version
|
||||
version=`kompose version`
|
||||
|
||||
# Warning Template
|
||||
warning="Buildconfig using $uri::$branch as source."
|
||||
# Replacing variables with current branch and uri
|
||||
sed -e "s;%VERSION%;$version;g" -e "s;%URI%;$uri;g" -e "s;%REF%;$branch;g" $KOMPOSE_ROOT/script/test/fixtures/nginx-node-redis/output-os-template.json > /tmp/output-os.json
|
||||
|
||||
|
||||
|
||||
## TEST V2
|
||||
DIR="v2"
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false"
|
||||
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.json"
|
||||
os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.json"
|
||||
|
||||
convert::expect_success "$k8s_cmd" "$k8s_output"
|
||||
convert::expect_success "$os_cmd" "$os_output"
|
||||
|
||||
|
||||
|
||||
## TEST V3
|
||||
DIR="v3.0"
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false"
|
||||
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/$DIR/docker-compose.yaml convert --stdout -j --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-k8s.json"
|
||||
os_output="$KOMPOSE_ROOT/script/test/fixtures/$DIR/output-os.json"
|
||||
|
||||
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output"
|
||||
convert::expect_success_and_warning "$os_cmd" "$os_output"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user