Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
springboot-maven3-centos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas MENARD
springboot-maven3-centos
Commits
65b00fc9
Commit
65b00fc9
authored
8 years ago
by
Luis Fernando Gomes
Browse files
Options
Downloads
Patches
Plain Diff
Add container_ip when run in boot2docker
parent
c283ee66
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/run
+16
-8
16 additions, 8 deletions
test/run
with
16 additions
and
8 deletions
test/run
+
16
−
8
View file @
65b00fc9
...
@@ -21,9 +21,9 @@ if (echo "$OSTYPE" | egrep -qs 'darwin'); then
...
@@ -21,9 +21,9 @@ if (echo "$OSTYPE" | egrep -qs 'darwin'); then
!
type
-a
"gmktemp"
&>
"/dev/null"
||
MKTEMP_EXEC
=
"gmktemp"
!
type
-a
"gmktemp"
&>
"/dev/null"
||
MKTEMP_EXEC
=
"gmktemp"
fi
fi
test_project
=
${
1
}
test_project
=
${
1
}
test_dir
=
"
$(
$READLINK_EXEC
-zf
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
))
"
test_dir
=
"
$(
$READLINK_EXEC
-zf
$(
dirname
"
${
0
}
"
))
"
image_dir
=
$(
$READLINK_EXEC
-zf
${
test_dir
}
/..
)
image_dir
=
$(
$READLINK_EXEC
-zf
${
test_dir
}
/..
)
scripts_url
=
"file://
${
image_dir
}
/.s
t
i/bin"
scripts_url
=
"file://
${
image_dir
}
/.s
2
i/bin"
cid_file
=
$(
$MKTEMP_EXEC
-u
--suffix
=
.cid
)
cid_file
=
$(
$MKTEMP_EXEC
-u
--suffix
=
.cid
)
# Since we built the candidate image locally, we don't want S2I to attempt to pull
# Since we built the candidate image locally, we don't want S2I to attempt to pull
...
@@ -53,8 +53,16 @@ container_ip() {
...
@@ -53,8 +53,16 @@ container_ip() {
fi
fi
}
}
container_port
()
{
if
(
echo
"
$OSTYPE
"
| egrep
-qs
'darwin'
)
;
then
docker inspect
--format
=
'{{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}}'
$(
cat
$cid_file
)
else
echo
$test_port
fi
}
run_s2i_build
()
{
run_s2i_build
()
{
s2i build
--incremental
=
true
${
s
t
i_args
}
file://
${
test_dir
}
/
${
test_project
}
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-
${
test_project
}
s2i build
--incremental
=
true
${
s
2
i_args
}
file://
${
test_dir
}
/
${
test_project
}
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-
${
test_project
}
}
}
prepare
()
{
prepare
()
{
...
@@ -114,7 +122,7 @@ wait_for_cid() {
...
@@ -114,7 +122,7 @@ wait_for_cid() {
test_s2i_usage
()
{
test_s2i_usage
()
{
info
"Testing the 'sti usage' command"
info
"Testing the 'sti usage' command"
s2i usage
${
s
t
i_args
}
${
IMAGE_NAME
}
&>/dev/null
s2i usage
${
s
2
i_args
}
${
IMAGE_NAME
}
&>/dev/null
}
}
test_docker_run_usage
()
{
test_docker_run_usage
()
{
...
@@ -123,19 +131,19 @@ test_docker_run_usage() {
...
@@ -123,19 +131,19 @@ test_docker_run_usage() {
}
}
test_connection
()
{
test_connection
()
{
info
"Testing the HTTP connection (http://
$(
container_ip
)
:
$
{
test
_port
}
)"
info
"Testing the HTTP connection (http://
$(
container_ip
)
:
$
(
container
_port
)
)"
local
max_attempts
=
10
local
max_attempts
=
10
local
sleep_time
=
1
local
sleep_time
=
1
local
attempt
=
1
local
attempt
=
1
local
result
=
1
local
result
=
1
while
[
$attempt
-le
$max_attempts
]
;
do
while
[
$attempt
-le
$max_attempts
]
;
do
ech
o
"Sending GET request to http://
$(
container_ip
)
:
$
{
test
_port
}
/"
inf
o
"Sending GET request to http://
$(
container_ip
)
:
$
(
container
_port
)
/"
if
(
echo
"
$OSTYPE
"
| egrep
-qs
'darwin'
)
;
then
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
"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
"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
}
/"
echo
"docker run --rm -it sequenceiq/alpine-curl curl -s -w %{http_code} -o /dev/null http://
$(
container_ip
)
:
$
(
container
_port
)
/"
fi
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
)
:
$
(
container
_port
)
/
)
status
=
$?
status
=
$?
if
[
$status
-eq
0
]
;
then
if
[
$status
-eq
0
]
;
then
if
[
$response_code
-eq
200
]
;
then
if
[
$response_code
-eq
200
]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment