Last active
January 16, 2018 12:50
-
-
Save rkhozinov/9f52364f193e1058803f8ab5f764bd12 to your computer and use it in GitHub Desktop.
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
# Glusterfs library: http://libgfapi-python.readthedocs.io/en/latest/ | |
# Glusterfs library Volume API: http://libgfapi-python.readthedocs.io/en/latest/api-reference.html#volume-class | |
# Docker library: https://docker-py.readthedocs.io/en/stable/ | |
# Testinfra docs: http://testinfra.readthedocs.io/en/latest/ | |
# Pytest docs: https://docs.pytest.org/en/latest/example/simple.html | |
# Run pytest from python: https://docs.pytest.org/en/latest/usage.html#calling-pytest-from-python-code | |
# Pytest logging: http://pythontesting.net/framework/pytest/pytest-logging-real-time/ | |
import testinfra | |
import pytest | |
import pprint | |
class TestDevopsPortal: | |
def setup(self): | |
self.b = testinfra.get_backend("local://") | |
pillar = self.b.Salt('pillar.get','devops_portal') | |
self.services = pillar['config']['service'] | |
def teardown(self): | |
pass | |
@pytest.mark.parametrize("name, file", [ | |
("passwd", "/etc/passwd"), | |
("hosts", "/etc/hosts"), | |
]) | |
def test_service_files(self, name, file): | |
assert self.b.File(file).is_file | |
@pytest.mark.parametrize('service', [ | |
'pushkin', | |
'rundeck', | |
'elastichsearch', | |
]) | |
def test_devops_portal(self, service): | |
assert self.services.has_key(service) | |
socket="tcp://{address}:{port}".format(**self.services[service]['endpoint']) | |
assert self.b.Socket(socket).is_listening |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment