-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #588 from ashetty1/kompose_labels_test
Adding tests for kompose-specific labels and buildconfig dockerfile construct
- Loading branch information
Showing
10 changed files
with
200 additions
and
10 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
script/test_in_openshift/compose-files/docker-compose-bc-dockerfile.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: "2" | ||
|
||
services: | ||
foo: | ||
build: | ||
context: "../../../examples/buildconfig/build" | ||
dockerfile: "Dockerfile" | ||
command: "sleep 3600" |
7 changes: 7 additions & 0 deletions
7
script/test_in_openshift/compose-files/docker-compose-restart-always.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '2' | ||
|
||
services: | ||
pival: | ||
image: perl | ||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] | ||
restart: "always" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# Copyright 2017 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. | ||
|
||
# Test case for buildconfig on kompose | ||
|
||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..) | ||
source $KOMPOSE_ROOT/script/test/cmd/lib.sh | ||
source $KOMPOSE_ROOT/script/test_in_openshift/lib.sh | ||
|
||
convert::print_msg "Testing buildconfig dockerfile construct in kompose" | ||
|
||
docker_compose_file="${KOMPOSE_ROOT}/script/test_in_openshift/compose-files/docker-compose-bc-dockerfile.yml" | ||
|
||
# Run kompose up | ||
convert::kompose_up $docker_compose_file | ||
|
||
# Check if the pods are up. | ||
convert::kompose_up_check -p foo | ||
|
||
# Kompose down for buildconfig fails being tracked at #382 | ||
# convert::kompose_down $docker_compose_file | ||
|
||
# convert::kompose_down_check 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 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. | ||
|
||
|
||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..) | ||
source $KOMPOSE_ROOT/script/test/cmd/lib.sh | ||
source $KOMPOSE_ROOT/script/test_in_openshift/lib.sh | ||
|
||
convert::print_msg "Testing restart: 'always'" | ||
|
||
docker_compose_file="${KOMPOSE_ROOT}/script/test_in_openshift/compose-files/docker-compose-restart-always.yml" | ||
|
||
# Run kompose up | ||
convert::kompose_up $docker_compose_file | ||
|
||
# Check if the pods are up | ||
retry_up=0 | ||
|
||
while [ $(oc get pods --no-headers | wc -l ) -ne 1 ] || | ||
[ $(oc get pods --no-headers | awk '{ print $4 }') -eq 0 ]; do | ||
if [ $retry_up -lt 240 ]; then | ||
retry_up=$(($retry_up + 1)) | ||
sleep 1 | ||
else | ||
exit 1 | ||
fi | ||
done | ||
|
||
if [ $(oc get pods --no-headers | awk '{ print $4 }') > 0 ]; then | ||
convert::print_pass "restart option set to 'always' is working as expected\n" | ||
oc get pods | ||
fi | ||
|
||
# Run Kompose down | ||
convert::kompose_down $docker_compose_file | ||
|
||
convert::kompose_down_check 1 |
40 changes: 40 additions & 0 deletions
40
script/test_in_openshift/tests/routes-service-expose-hostname.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 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. | ||
|
||
# Test case for checking kompose.service.expose label in kompose | ||
|
||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..) | ||
source $KOMPOSE_ROOT/script/test/cmd/lib.sh | ||
source $KOMPOSE_ROOT/script/test_in_openshift/lib.sh | ||
|
||
docker_compose_file="${KOMPOSE_ROOT}/script/test/fixtures/expose-service/compose-files/docker-compose-expose-hostname.yml" | ||
|
||
convert::print_msg "Testing kompose-specific label:kompose.service.expose=hostname " | ||
|
||
# Run kompose up | ||
convert::kompose_up $docker_compose_file | ||
|
||
# Check if the pods are up | ||
convert::kompose_up_check -p "web redis" | ||
|
||
# Check if the service has been exposed | ||
convert::oc_check_route "batman.example.com" | ||
|
||
# Run Kompose down | ||
convert::kompose_down $docker_compose_file | ||
|
||
# Check if the pods have been terminated | ||
convert::kompose_down_check 2 |
40 changes: 40 additions & 0 deletions
40
script/test_in_openshift/tests/routes-service-expose-true.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2017 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. | ||
|
||
# Test case for checking routes construct with kompose | ||
|
||
KOMPOSE_ROOT=$(readlink -f $(dirname "${BASH_SOURCE}")/../../..) | ||
source $KOMPOSE_ROOT/script/test/cmd/lib.sh | ||
source $KOMPOSE_ROOT/script/test_in_openshift/lib.sh | ||
|
||
docker_compose_file="${KOMPOSE_ROOT}/script/test/fixtures/expose-service/compose-files/docker-compose-expose-true.yml" | ||
|
||
convert::print_msg "Running tests for kompose-specific labels: 'kompose.service.expose:True'" | ||
|
||
# Run kompose up | ||
convert::kompose_up $docker_compose_file | ||
|
||
# Check if the pods are up | ||
convert::kompose_up_check -p "web redis" | ||
|
||
# Check if the service has been exposed | ||
convert::oc_check_route "true" | ||
|
||
# Run Kompose down | ||
convert::kompose_down $docker_compose_file | ||
|
||
# Check if the pods have been term | ||
convert::kompose_down_check 2 |