forked from vishnubob/wait-for-it
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from vishnubob/master
Update fork from upstream
- Loading branch information
Showing
8 changed files
with
126 additions
and
47 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
**/*.pyc | ||
.pydevproject | ||
|
||
/vendor/ |
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,7 @@ | ||
{ | ||
"name": "vishnubob/wait-for-it", | ||
"description": "Pure bash script to test and wait on the availability of a TCP host and port", | ||
"type": "library", | ||
"license": "MIT", | ||
"bin": ["wait-for-it.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,18 @@ | ||
# Tests for wait-for-it | ||
|
||
* wait-for-it.py - pytests for wait-for-it.sh | ||
* container-runners.py - Runs wait-for-it.py tests in multiple containers | ||
* requirements.txt - pip requirements for container-runners.py | ||
|
||
To run the basic tests: | ||
|
||
``` | ||
python wait-for-it.py | ||
``` | ||
|
||
Many of the issues encountered have been related to differences between operating system versions. The container-runners.py script provides an easy way to run the python wait-for-it.py tests against multiple system configurations: | ||
|
||
``` | ||
pip install -r requirements.txt | ||
python container-runners.py | ||
``` |
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 @@ | ||
#!/usr/bin/env python | ||
|
||
# Unit tests to run wait-for-it.py unit tests in several different docker images | ||
|
||
import unittest | ||
import os | ||
import docker | ||
from parameterized import parameterized | ||
|
||
client = docker.from_env() | ||
app_path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..')) | ||
volumes = {app_path: {'bind': '/app', 'mode': 'ro'}} | ||
|
||
class TestContainers(unittest.TestCase): | ||
""" | ||
Test multiple container types with the test cases in wait-for-it.py | ||
""" | ||
|
||
@parameterized.expand([ | ||
"python:3.5-buster", | ||
"python:3.5-stretch", | ||
"dougg/alpine-busybox:alpine-3.11.3_busybox-1.30.1", | ||
"dougg/alpine-busybox:alpine-3.11.3_busybox-1.31.1" | ||
]) | ||
def test_image(self, image): | ||
print(image) | ||
command="/app/test/wait-for-it.py" | ||
container = client.containers.run(image, command=command, volumes=volumes, detach=True) | ||
result = container.wait() | ||
logs = container.logs() | ||
container.remove() | ||
self.assertEqual(result["StatusCode"], 0) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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,2 @@ | ||
docker>=4.0.0 | ||
parameterized>=0.7.0 |
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