Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wait-for-it
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joël Schwab
wait-for-it
Commits
7f645ced
Commit
7f645ced
authored
8 years ago
by
Douglas Gibbons
Browse files
Options
Downloads
Patches
Plain Diff
Start of test framework
parent
ac372412
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
.travis.yml
+5
-0
5 additions, 0 deletions
.travis.yml
test/wait-for-it.py
+40
-0
40 additions, 0 deletions
test/wait-for-it.py
with
48 additions
and
0 deletions
.gitignore
0 → 100644
+
3
−
0
View file @
7f645ced
**/*.pyc
.pydevproject
This diff is collapsed.
Click to expand it.
.travis.yml
0 → 100644
+
5
−
0
View file @
7f645ced
language
:
python
python
:
-
"
2.7"
script
:
python test/wait-for-it.py
This diff is collapsed.
Click to expand it.
test/wait-for-it.py
0 → 100644
+
40
−
0
View file @
7f645ced
import
unittest
import
subprocess
import
shlex
from
subprocess
import
Popen
,
PIPE
import
os
import
sys
class
TestWaitForIt
(
unittest
.
TestCase
):
def
execute
(
self
,
cmd
):
"""
Executes a command and returns exit code, STDOUT, STDERR
"""
args
=
shlex
.
split
(
cmd
)
proc
=
Popen
(
args
,
stdout
=
PIPE
,
stderr
=
PIPE
)
out
,
err
=
proc
.
communicate
()
exitcode
=
proc
.
returncode
return
exitcode
,
out
,
err
def
setUp
(
self
):
script_path
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
parent_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
script_path
,
os
.
pardir
))
self
.
wait_script
=
os
.
path
.
join
(
parent_path
,
"
wait-for-it.sh
"
)
def
test_no_args_return_code
(
self
):
# Return code should be 1 when called with no args
exitcode
,
out
,
err
=
self
.
execute
(
self
.
wait_script
)
self
.
assertEqual
(
exitcode
,
1
)
def
test_help
(
self
):
exitcode
,
out
,
err
=
self
.
execute
(
self
.
wait_script
+
"
--help
"
)
# STDERR should begin with "Usage:"
self
.
assertTrue
(
err
.
startswith
(
"
Usage:
"
))
# exit code should be 1
self
.
assertEqual
(
exitcode
,
1
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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