ansible-role-gitlab/molecule/default/tests/test_default.py

38 lines
1,003 B
Python
Raw Normal View History

2020-04-11 13:16:20 +00:00
import testinfra.utils.ansible_runner
def test_packages(host):
package = host.package('gitlab-ce')
assert package.is_installed
2021-08-24 05:59:04 +00:00
def test_git_directory(host):
path = host.file('/opt/data/git')
assert path.exists
assert path.is_directory
2020-04-11 13:16:20 +00:00
def test_config_file(host):
config = host.file('/etc/gitlab/gitlab.rb')
assert config.exists
assert config.is_file
assert config.user == 'root'
assert config.group == 'root'
assert config.mode == 0o600
assert config.contains("external_url 'http://gitlab.example.com'")
assert config.contains("grafana\\['enable'\\] = false")
assert config.contains('label: Main AD')
2020-04-11 13:16:20 +00:00
def test_service(host):
service = host.service('gitlab-runsvdir')
assert service.is_running
assert service.is_enabled
def test_socket(host):
socket = host.socket('tcp://0.0.0.0:80')
assert socket.is_listening
def test_grafana_down(host):
try:
host.process.get(user='gitlab-prometheus', comm='grafana-server')
assert False
except:
assert True