Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.

Commit 6b942e5

Browse files
authored
fix tests and add vertx test (#60)
* add vertx tests * delete devfile.yaml from example repo if exists
1 parent 7e8e362 commit 6b942e5

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

scripts/test.sh

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ executedTests=0
1212
getURL() {
1313
urlName=$1
1414
# get 3rd column from last line
15-
url=$(odo url list | tail -1 | awk '{ print $3 }')
15+
url=$(odo url list | grep ${urlName} | tail -1 | awk '{ print $3 }')
1616
echo "$url"
1717
}
1818

@@ -87,10 +87,9 @@ waitForDebugCheck() {
8787
test() {
8888
devfileName=$1
8989
exampleRepo=$2
90-
exampleDir=$3
91-
urlPort=$4
92-
urlPath=$5
93-
checkString=$6
90+
urlPort=$3
91+
urlPath=$4
92+
checkString=$5
9493

9594
# remember if there was en error
9695
error=false
@@ -99,7 +98,10 @@ test() {
9998
cd "$tmpDir" || return 1
10099

101100
git clone --depth 1 "$exampleRepo" .
102-
cd "${tmpDir}/${exampleDir}" || return 1
101+
102+
# examples used in tests might contain Devfile.yaml
103+
# in this case it would break the test
104+
rm -rf devfile.yaml devfile.yml
103105

104106
odo project create "$devfileName" || error=true
105107
odo create "$devfileName" --devfile "$DEVFILES_DIR/$devfileName/devfile.yaml" || error=true
@@ -140,20 +142,23 @@ test() {
140142

141143
return 0
142144
}
143-
144-
145-
# run odo in experimental mode
146-
odo preference set -f experimental true
147-
145+
148146

149147
# run test scenarios
150-
test "java-maven" "https://github.com/odo-devfiles/springboot-ex.git" "/" "8080" "/" "You are currently running a Spring server built for the IBM Cloud"
151-
test "java-openliberty" "https://github.com/OpenLiberty/application-stack-intro.git" "/" "9080" "/api/resource" "Hello! Welcome to Open Liberty"
152-
test "java-quarkus" "https://github.com/odo-devfiles/quarkus-ex" "/" "8080" "/" "Congratulations, you have created a new Quarkus application."
153-
test "java-springboot" "https://github.com/odo-devfiles/springboot-ex.git" "/" "8080" "/" "You are currently running a Spring server built for the IBM Cloud"
154-
test "nodejs" "https://github.com/odo-devfiles/nodejs-ex.git" "/" "3000" "/" "Hello from Node.js Starter Application!"
155-
test "python" "https://github.com/odo-devfiles/python-ex.git" "/" "8000" "/" "Hello World!"
156-
test "python-django" "https://github.com/odo-devfiles/python-django-ex.git" "/" "8000" "/" "The install worked successfully! Congratulations!"
148+
# parameters:
149+
# - name of a devfile (directory in devfile registry)
150+
# - git url of an example application
151+
# - port number for which url will be created
152+
# - url path to check for response (usually "/")
153+
# - string that url response must contain to checking that application is running corect
154+
test "java-maven" "https://github.com/odo-devfiles/springboot-ex.git" "8080" "/" "You are currently running a Spring server built for the IBM Cloud"
155+
test "java-openliberty" "https://github.com/OpenLiberty/application-stack-intro.git" "9080" "/api/resource" "Hello! Welcome to Open Liberty"
156+
test "java-quarkus" "https://github.com/odo-devfiles/quarkus-ex" "8080" "/" "Congratulations, you have created a new Quarkus application."
157+
test "java-springboot" "https://github.com/odo-devfiles/springboot-ex.git" "8080" "/" "You are currently running a Spring server built for the IBM Cloud"
158+
test "nodejs" "https://github.com/odo-devfiles/nodejs-ex.git" "3000" "/" "Hello from Node.js Starter Application!"
159+
test "python" "https://github.com/odo-devfiles/python-ex.git" "8080" "/" "Hello World!"
160+
test "python-django" "https://github.com/odo-devfiles/python-django-ex.git" "8000" "/" "The install worked successfully! Congratulations!"
161+
test "java-vertx" "https://github.com/jponge/vertx-ex" "8080" "/" "Hello from Vert.x"
157162

158163

159164
# remember if there was an error so the script can exist with proper exit code at the end
@@ -177,4 +182,4 @@ fi
177182
if [ "$error" = "true" ]; then
178183
exit 1
179184
fi
180-
exit 0
185+
exit 0

0 commit comments

Comments
 (0)