Add deployment test scenario 3 components on 1 host (#277)
This commit is contained in:
parent
1eaf774e33
commit
7fcb118c8c
@ -210,7 +210,16 @@ jobs:
|
|||||||
name: Run the scenario
|
name: Run the scenario
|
||||||
command: deployment-e2e/molecule.sh repo
|
command: deployment-e2e/molecule.sh repo
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 40m
|
||||||
|
deployment-multiple:
|
||||||
|
executor: tokenbridge-orb/machine-with-docker-caching
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: git submodule update --init
|
||||||
|
- run:
|
||||||
|
name: Run the scenario
|
||||||
|
command: deployment-e2e/molecule.sh multiple
|
||||||
|
no_output_timeout: 40m
|
||||||
|
|
||||||
ultimate:
|
ultimate:
|
||||||
executor: tokenbridge-orb/machine-with-docker-caching
|
executor: tokenbridge-orb/machine-with-docker-caching
|
||||||
parameters:
|
parameters:
|
||||||
@ -272,6 +281,7 @@ workflows:
|
|||||||
- deployment-ui
|
- deployment-ui
|
||||||
- deployment-monitor
|
- deployment-monitor
|
||||||
- deployment-repo
|
- deployment-repo
|
||||||
|
- deployment-multiple
|
||||||
- ultimate:
|
- ultimate:
|
||||||
name: "ultimate: native to erc"
|
name: "ultimate: native to erc"
|
||||||
scenario-name: native-to-erc
|
scenario-name: native-to-erc
|
||||||
|
14
deployment-e2e/molecule/multiple/Dockerfile.j2
Normal file
14
deployment-e2e/molecule/multiple/Dockerfile.j2
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{% if item.registry is defined %}
|
||||||
|
FROM {{ item.registry.url }}/{{ item.image }}
|
||||||
|
{% else %}
|
||||||
|
FROM {{ item.image }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||||
|
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
|
||||||
|
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||||
|
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
|
||||||
|
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||||
|
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
|
59
deployment-e2e/molecule/multiple/molecule.yml
Normal file
59
deployment-e2e/molecule/multiple/molecule.yml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
enabled: True
|
||||||
|
options:
|
||||||
|
config-data:
|
||||||
|
ignore: ../../hosts.yml
|
||||||
|
platforms:
|
||||||
|
- name: multiple-host
|
||||||
|
groups:
|
||||||
|
- example
|
||||||
|
children:
|
||||||
|
- oracle
|
||||||
|
- monitor
|
||||||
|
- ui
|
||||||
|
image: ubuntu:16.04
|
||||||
|
privileged: true
|
||||||
|
network_mode: host
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
enabled: True
|
||||||
|
options:
|
||||||
|
r: ["bug"]
|
||||||
|
playbooks:
|
||||||
|
prepare: ../prepare.yml
|
||||||
|
converge: ../monitor/converge.yml
|
||||||
|
inventory:
|
||||||
|
host_vars:
|
||||||
|
multiple-host:
|
||||||
|
ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9"
|
||||||
|
MONITOR_PORT: 3003
|
||||||
|
syslog_server_port: "udp://127.0.0.1:514"
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
||||||
|
additional_files_or_dirs:
|
||||||
|
- ../../tests/*
|
||||||
|
scenario:
|
||||||
|
name: multiple
|
||||||
|
test_sequence:
|
||||||
|
- lint
|
||||||
|
- cleanup
|
||||||
|
- destroy
|
||||||
|
- dependency
|
||||||
|
- syntax
|
||||||
|
- create
|
||||||
|
- prepare
|
||||||
|
- converge
|
||||||
|
- verify
|
||||||
|
- destroy
|
32
deployment-e2e/molecule/multiple/tests/test_multiple.py
Normal file
32
deployment-e2e/molecule/multiple/tests/test_multiple.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import os
|
||||||
|
import pytest
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("service", [
|
||||||
|
("poabridge"),
|
||||||
|
("tokenbridge-ui"),
|
||||||
|
("tokenbridge-monitor")
|
||||||
|
])
|
||||||
|
def test_services(host, service):
|
||||||
|
assert host.service(service).is_enabled
|
||||||
|
assert host.service(service).is_running
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("name", [
|
||||||
|
("oracle_rabbit_1"),
|
||||||
|
("oracle_redis_1"),
|
||||||
|
("oracle_bridge_request_1"),
|
||||||
|
("oracle_bridge_collected_1"),
|
||||||
|
("oracle_bridge_affirmation_1"),
|
||||||
|
("oracle_bridge_senderhome_1"),
|
||||||
|
("oracle_bridge_senderforeign_1"),
|
||||||
|
("ui_ui_1"),
|
||||||
|
("monitor_monitor_1")
|
||||||
|
])
|
||||||
|
def test_docker_containers(host, name):
|
||||||
|
container = host.docker(name)
|
||||||
|
assert container.is_running
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Check if component is already deployed
|
- name: Check if component is already deployed
|
||||||
shell: "test -f {{ bridge_path }}/{{ component }}/docker-compose.yml && echo 'true'"
|
shell: "test -f {{ bridge_path }}/{{ component }}/.env && echo 'true'"
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
register: already_deployed
|
register: already_deployed
|
||||||
when: check_deployed is defined
|
when: check_deployed is defined
|
||||||
|
Loading…
Reference in New Issue
Block a user