@ -3,26 +3,25 @@
|
||||
# Unit tests to run wait-for-it.py unit tests in several different docker images
|
||||
|
||||
import unittest
|
||||
from ddt import ddt, data
|
||||
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'}}
|
||||
|
||||
@ddt
|
||||
class TestContainers(unittest.TestCase):
|
||||
"""
|
||||
Test multiple container types with the test cases in wait-for-it.py
|
||||
"""
|
||||
|
||||
@data(
|
||||
@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",
|
||||
)
|
||||
"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"
|
||||
@ -30,7 +29,7 @@ class TestContainers(unittest.TestCase):
|
||||
result = container.wait()
|
||||
logs = container.logs()
|
||||
container.remove()
|
||||
self.assertEqual(result, 0, logs)
|
||||
self.assertEqual(result["StatusCode"], 0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
@ -1,2 +1,2 @@
|
||||
docker>=2.0.0
|
||||
dtt>=1.2.0
|
||||
docker>=4.0.0
|
||||
parameterized>=0.7.0
|
||||
|
Reference in New Issue
Block a user