Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ EXTRA_VARS := --extra-vars "@$(ROOT_PATH)/vars.yml"
COLLECTION_PATH := $(ROOT_PATH)/e2e/collections/ansible_collections/e2e/tests
# Remove expose-pods-by-name from the CI tests, until we close
# this issue https://github.com/skupperproject/skupper/issues/2251
TESTS_CI := attached-connector,ha,hello-world,labels-and-annotations
TESTS_CI := attached-connector,ha,hello-world,labels-and-annotations,system-sites

# E2E Test directories
E2E_TEST_DIRS := $(sort $(wildcard $(ROOT_PATH)/e2e/scenarios/*))
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/scenarios/system-sites/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[defaults]
collections_path = ../../collections
roles_path = ../../collections/ansible_collections/e2e/tests/roles
deprecation_warnings = False

[persistent_connection]
connect_timeout = 30
command_timeout = 30
34 changes: 34 additions & 0 deletions tests/e2e/scenarios/system-sites/cleanup-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: "[ {{ test_identifier }} ] - Cleanup frontend container"
ansible.builtin.command:
cmd: "{{ platform }} rm -f frontend"
failed_when: false
when:
- not skip_teardown | default(false) | bool
- "'west' in inventory_hostname"

- name: "[ {{ test_identifier }} ] - Cleanup backend container"
ansible.builtin.command:
cmd: "{{ platform }} rm -f backend"
failed_when: false
when:
- not skip_teardown | default(false) | bool
- "'east' in inventory_hostname"

- name: "[ {{ test_identifier }} ] - Stop namespaces"
skupper.v2.system:
action: stop
Comment thread
fgiorgetti marked this conversation as resolved.
namespace: "{{ namespace_name }}"
platform: "{{ platform }}"
failed_when: false
when: not skip_teardown | default(false) | bool

- name: "[ {{ test_identifier }} ] - Uninstall system controller"
skupper.v2.controller:
action: uninstall
platform: "{{ platform }}"
failed_when: false
run_once: true
when: not skip_teardown | default(false) | bool


Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
ansible_connection: local
ansible_user: "{{ lookup('env', 'USER') }}"
ansible_python_interpreter: /usr/bin/python3
debug: false
namespace_prefix: "e2e-system-sites"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# Platform configuration
platform: docker
namespace_name: east
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Platform configuration
platform: docker
namespace_name: west

5 changes: 5 additions & 0 deletions tests/e2e/scenarios/system-sites/inventory/hosts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
all:
hosts:
west:
east:
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: skupper.io/v2alpha1
kind: Connector
metadata:
name: backend
spec:
routingKey: backend
port: 9090
host: 127.0.0.1
5 changes: 5 additions & 0 deletions tests/e2e/scenarios/system-sites/resources/east/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: skupper.io/v2alpha1
kind: Site
metadata:
name: east
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: skupper.io/v2alpha1
kind: Listener
metadata:
name: backend
spec:
routingKey: backend
port: 8080
host: 127.0.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: skupper.io/v2alpha1
kind: RouterAccess
metadata:
name: router-access-west
namespace: west
spec:
roles:
- name: inter-router
port: 55671
- name: edge
port: 45671
subjectAlternativeNames:
- 0.0.0.0
- '::'
7 changes: 7 additions & 0 deletions tests/e2e/scenarios/system-sites/resources/west/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: skupper.io/v2alpha1
kind: Site
metadata:
name: west
spec:
linkAccess: default
98 changes: 98 additions & 0 deletions tests/e2e/scenarios/system-sites/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
- name: Hello World System Sites Test (Manual Reload)
hosts: all
roles:
- e2e.tests.skupper_test_images

vars:
test_identifier: "Hello World with System Sites (Manual Reload)"

environment:
SKUPPER_PLATFORM: "{{ platform }}"

tasks:
# Pre-test cleanup
- name: "[ {{ test_identifier }} ] - Pre-test cleanup"
ansible.builtin.include_tasks: cleanup-tasks.yml

- name: "[ {{ test_identifier }} ] - Main test block"
block:
- name: "[ {{ test_identifier }} ] - Install system controller"
skupper.v2.controller:
action: install
Comment thread
fgiorgetti marked this conversation as resolved.
platform: "{{ platform }}"
failed_when: false
Comment thread
fgiorgetti marked this conversation as resolved.
Outdated
run_once: true
delegate_to: localhost
register: system_install

# West Site - Setup and get token
- name: "[ {{ test_identifier }} ] - West Site Setup"
block:
- name: "[ {{ test_identifier }} ] - Deploy frontend service"
ansible.builtin.shell:
cmd: "{{ platform }} run --name frontend -d --rm -p 127.0.0.1:7070:8080 quay.io/skupper/hello-world-frontend --backend http://host.containers.internal:8080"
changed_when: false
when: "'west' in inventory_hostname"
Comment thread
fgiorgetti marked this conversation as resolved.
Outdated

- name: "[ {{ test_identifier }} ] - Apply west site resources"
skupper.v2.resource:
path: "{{ playbook_dir }}/resources/west/"
platform: "{{ platform }}"
namespace: "{{ namespace_name }}"
when: "'west' in inventory_hostname"

- name: "[ {{ test_identifier }} ] - Start west namespace"
skupper.v2.system:
action: start
Comment thread
fgiorgetti marked this conversation as resolved.
platform: "{{ platform }}"
namespace: "{{ namespace_name }}"
register: west

when: "'west' in inventory_hostname"
run_once: true

# East Site - Must run after token is created
- name: "[ {{ test_identifier }} ] - East Site Setup"
block:
- name: "[ {{ test_identifier }} ] - Deploy backend service"
ansible.builtin.shell:
cmd: "{{ platform }} run --name backend -d --rm -p 127.0.0.1:9090:8080 quay.io/skupper/hello-world-backend"
changed_when: false
register: backend_deploy

- name: "[ {{ test_identifier }} ] - Apply east site resources"
skupper.v2.resource:
path: "{{ playbook_dir }}/resources/east/"
platform: "{{ platform }}"
namespace: "{{ namespace_name }}"
when: "'east' in inventory_hostname"
Comment thread
fgiorgetti marked this conversation as resolved.
Outdated

- name: "[ {{ test_identifier }} ] - Apply token to east site"
skupper.v2.resource:
def: "{{ west.links['0.0.0.0'] }}"
namespace: "{{ namespace_name }}"
platform: "{{ platform }}"

- name: "[ {{ test_identifier }} ] - Start east namespace"
skupper.v2.system:
action: start
Comment thread
fgiorgetti marked this conversation as resolved.
platform: "{{ platform }}"
namespace: "{{ namespace_name }}"
register: east
when: "'east' in inventory_hostname"

# Verify connectivity - test if backend is accessible from frontend container
- name: "[ {{ test_identifier }} ] - Test via Skupper (listener)"
ansible.builtin.command:
cmd: "curl -s -f http://127.0.0.1:8080/api/hello"
register: curl_result
retries: 10
delay: 10
until: curl_result.rc == 0
when: "'west' in inventory_hostname"
changed_when: false

always:
- name: "[ {{ test_identifier }} ] - Post-test cleanup"
ansible.builtin.include_tasks: cleanup-tasks.yml
Loading