Adding tests for CI
Signed-off-by: Clement Verna <cverna@tutanota.com>
This commit is contained in:
parent
3ef4bcc8e6
commit
19416e321d
4 changed files with 52 additions and 0 deletions
3
tests/integration/runtest.sh
Executable file
3
tests/integration/runtest.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
pytest-3 -vv ./test_container.py
|
||||
34
tests/integration/test_container.py
Normal file
34
tests/integration/test_container.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
import conu
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
IMAGE = os.environ.get("IMAGE_NAME", "registry.fedoraproject.org/fedora")
|
||||
TAG = os.environ.get("IMAGE_TAG", "latest")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def container(request):
|
||||
with conu.DockerBackend(logging_level=logging.DEBUG) as backend:
|
||||
im = backend.ImageClass(IMAGE, tag=TAG)
|
||||
container = im.run_via_binary(b)
|
||||
yield container
|
||||
container.stop()
|
||||
container.delete()
|
||||
|
||||
|
||||
class TestContainer:
|
||||
def test_running(self, container):
|
||||
assert container.is_running()
|
||||
|
||||
def test_python3(self, container):
|
||||
container.execute(["python3", "-V"])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pytest.main()
|
||||
2
tests/inventory
Normal file
2
tests/inventory
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[all]
|
||||
localhost ansible_connection=local
|
||||
13
tests/tests.yml
Normal file
13
tests/tests.yml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- container
|
||||
tests:
|
||||
- integration
|
||||
required_packages:
|
||||
- python3-conu
|
||||
- python3-pytest
|
||||
- docker
|
||||
required_services:
|
||||
- docker
|
||||
Loading…
Add table
Add a link
Reference in a new issue