Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
springboot-maven3-centos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luiz.nunes
springboot-maven3-centos
Commits
5f477fe4
Commit
5f477fe4
authored
Sep 15, 2016
by
Luis Fernando Gomes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests for Mac
parent
ae85157b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
run
test/run
+26
-7
No files found.
test/run
View file @
5f477fe4
...
@@ -12,15 +12,23 @@ if [ $# -eq 0 ]; then
...
@@ -12,15 +12,23 @@ if [ $# -eq 0 ]; then
echo
"ERROR: No test project name has been passed."
echo
"ERROR: No test project name has been passed."
exit
1
exit
1
fi
fi
# Determining system utility executables (darwin compatibility check)
READLINK_EXEC
=
"readlink"
MKTEMP_EXEC
=
"mktemp"
if
(
echo
"
$OSTYPE
"
| egrep
-qs
'darwin'
)
;
then
!
type
-a
"greadlink"
&>
"/dev/null"
||
READLINK_EXEC
=
"greadlink"
!
type
-a
"gmktemp"
&>
"/dev/null"
||
MKTEMP_EXEC
=
"gmktemp"
fi
test_project
=
${
1
}
test_project
=
${
1
}
test_dir
=
"
$(
readlink
-zf
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
))
"
test_dir
=
"
$(
$READLINK_EXEC
-zf
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
))
"
image_dir
=
$(
readlink
-zf
${
test_dir
}
/..
)
image_dir
=
$(
$READLINK_EXEC
-zf
${
test_dir
}
/..
)
scripts_url
=
"file://
${
image_dir
}
/.sti/bin"
scripts_url
=
"file://
${
image_dir
}
/.sti/bin"
cid_file
=
$(
mktemp
-u
--suffix
=
.cid
)
cid_file
=
$(
$MKTEMP_EXEC
-u
--suffix
=
.cid
)
# Since we built the candidate image locally, we don't want S2I attempt to pull
# Since we built the candidate image locally, we don't want S2I
to
attempt to pull
# it from Docker hub
# it from Docker hub
s2i_args
=
"--force-pull=false"
s2i_args
=
"--force-pull=false
--loglevel=2
"
# Read exposed port from image meta data
# Read exposed port from image meta data
test_port
=
"
$(
docker inspect
--format
=
'{{range $key, $value := .ContainerConfig.ExposedPorts }}{{$key}}{{end}}'
${
IMAGE_NAME
}
| sed
's/\/.*//'
)
"
test_port
=
"
$(
docker inspect
--format
=
'{{range $key, $value := .ContainerConfig.ExposedPorts }}{{$key}}{{end}}'
${
IMAGE_NAME
}
| sed
's/\/.*//'
)
"
...
@@ -38,11 +46,15 @@ container_exists() {
...
@@ -38,11 +46,15 @@ container_exists() {
}
}
container_ip
()
{
container_ip
()
{
if
(
echo
"
$OSTYPE
"
| egrep
-qs
'darwin'
)
;
then
docker-machine ip
else
docker inspect
--format
=
"{{ .NetworkSettings.IPAddress }}"
$(
cat
$cid_file
)
docker inspect
--format
=
"{{ .NetworkSettings.IPAddress }}"
$(
cat
$cid_file
)
fi
}
}
run_s2i_build
()
{
run_s2i_build
()
{
s2i build
${
sti_args
}
file://
${
test_dir
}
/
${
test_project
}
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-
${
test_project
}
s2i build
--incremental
=
true
${
sti_args
}
file://
${
test_dir
}
/
${
test_project
}
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-
${
test_project
}
}
}
prepare
()
{
prepare
()
{
...
@@ -58,6 +70,7 @@ prepare() {
...
@@ -58,6 +70,7 @@ prepare() {
git config user.email
"build@localhost"
&&
git config user.name
"builder"
git config user.email
"build@localhost"
&&
git config user.name
"builder"
git add
-A
&&
git commit
-m
"Sample commit"
git add
-A
&&
git commit
-m
"Sample commit"
popd
>
/dev/null
popd
>
/dev/null
run_s2i_build
}
}
run_test_application
()
{
run_test_application
()
{
...
@@ -80,7 +93,7 @@ cleanup() {
...
@@ -80,7 +93,7 @@ cleanup() {
check_result
()
{
check_result
()
{
local
result
=
"
$1
"
local
result
=
"
$1
"
if
[[
"
$result
"
!=
"0"
]]
;
then
if
[[
"
$result
"
!=
"0"
]]
;
then
info
"TEST FAILED for
${
test_project
}
(
${
result
}
)"
info
"TEST FAILED for
${
test_project
}
(
exit code:
${
result
}
)"
cleanup
cleanup
exit
$result
exit
$result
fi
fi
...
@@ -116,6 +129,12 @@ test_connection() {
...
@@ -116,6 +129,12 @@ test_connection() {
local
attempt
=
1
local
attempt
=
1
local
result
=
1
local
result
=
1
while
[
$attempt
-le
$max_attempts
]
;
do
while
[
$attempt
-le
$max_attempts
]
;
do
echo
"Sending GET request to http://
$(
container_ip
)
:
${
test_port
}
/"
if
(
echo
"
$OSTYPE
"
| egrep
-qs
'darwin'
)
;
then
echo
"Warning for OSX users: if you can't access the container's IP
${
container_ip
}
directly (because you use boot2docker for example)"
echo
"you should run the curl command in a container, for example using:"
echo
"docker run --rm -it sequenceiq/alpine-curl curl -s -w %{http_code} -o /dev/null http://
$(
container_ip
)
:
${
test_port
}
/"
fi
response_code
=
$(
curl
-s
-w
%
{
http_code
}
-o
/dev/null http://
$(
container_ip
)
:
${
test_port
}
/
)
response_code
=
$(
curl
-s
-w
%
{
http_code
}
-o
/dev/null http://
$(
container_ip
)
:
${
test_port
}
/
)
status
=
$?
status
=
$?
if
[
$status
-eq
0
]
;
then
if
[
$status
-eq
0
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment