From c011f360582e914fa6442172c27325c653b1291a Mon Sep 17 00:00:00 2001 From: Andrea Manzini Date: Tue, 14 Nov 2023 08:38:09 +0100 Subject: [PATCH] Test for firewalld container in ALP product --- schedule/alp/firewalld_container.yaml | 14 ++++++ .../firewalld-container/firewalld_client.pm | 33 +++++++++++++ .../firewalld-container/firewalld_server.pm | 46 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 schedule/alp/firewalld_container.yaml create mode 100644 tests/microos/workloads/firewalld-container/firewalld_client.pm create mode 100644 tests/microos/workloads/firewalld-container/firewalld_server.pm diff --git a/schedule/alp/firewalld_container.yaml b/schedule/alp/firewalld_container.yaml new file mode 100644 index 000000000000..08824a1e7944 --- /dev/null +++ b/schedule/alp/firewalld_container.yaml @@ -0,0 +1,14 @@ +--- +name: Firewalld in a Container +description: > + Install and test firewalld container +conditional_schedule: + firewalld_container: + HOSTNAME: + 'client': + - microos/workloads/firewalld-container/firewalld_client + 'server': + - microos/workloads/firewalld-container/firewalld_server +schedule: + - microos/disk_boot + - '{{firewalld_container}}' diff --git a/tests/microos/workloads/firewalld-container/firewalld_client.pm b/tests/microos/workloads/firewalld-container/firewalld_client.pm new file mode 100644 index 000000000000..bbc173c2b172 --- /dev/null +++ b/tests/microos/workloads/firewalld-container/firewalld_client.pm @@ -0,0 +1,33 @@ +# SUSE"s openQA tests +# +# Copyright 2023 SUSE LLC +# SPDX-License-Identifier: FSFAP +# +# Package: podman firewalld-container +# Summary: install and verify firewalld container. +# Maintainer: QE Core + +use base "consoletest"; +use warnings; +use strict; +use testapi; +use serial_terminal 'select_serial_terminal'; +use lockapi; + +sub run { + my ($self) = @_; + select_serial_terminal; + record_info("1 client ip a", script_output("ip a")); + #setup MM networking + barrier_wait 'FIREWALLD_SERVER_READY'; + record_info("2 client ip a", script_output("ip a")); + # server port should be reachable + # die unless server_port_reachable(); + # barrier_wait 'FIREWALLD_SERVER_PORT_CLOSED'; + # # server port should not be reachable + # die if server_port_reachable(); + # barrier_wait 'FIREWALLD_SERVER_FINISHED'; +} + +1; + diff --git a/tests/microos/workloads/firewalld-container/firewalld_server.pm b/tests/microos/workloads/firewalld-container/firewalld_server.pm new file mode 100644 index 000000000000..326dafb1178a --- /dev/null +++ b/tests/microos/workloads/firewalld-container/firewalld_server.pm @@ -0,0 +1,46 @@ +# SUSE"s openQA tests +# +# Copyright 2023 SUSE LLC +# SPDX-License-Identifier: FSFAP +# +# Package: podman firewalld-container +# Summary: install and verify firewalld container. +# Maintainer: QE Core + +use base "consoletest"; +use warnings; +use strict; +use testapi; +use serial_terminal 'select_serial_terminal'; +use lockapi; + +sub run { + my ($self) = @_; + select_serial_terminal; + barrier_create('FIREWALLD_SERVER_READY', 2); + my $hostname = get_var('HOSTNAME'); + record_info("1 server ip a", script_output("ip a")); + # setup MM networking + # install software + barrier_wait 'FIREWALLD_SERVER_READY'; + # close port on firewall, client will test port + # barrier_wait 'FIREWALLD_SERVER_PORT_CLOSED'; + # end operations, cleanup + # barrier_wait 'FIREWALLD_SERVER_FINISHED'; + record_info("2 server ip a", script_output("ip a")); +} + +sub post_fail_hook { + barrier_destroy('FIREWALLD_SERVER_READY'); + select_serial_terminal; +} + +sub post_run_hook { + barrier_destroy('FIREWALLD_SERVER_READY'); + select_serial_terminal; +} + + + +1; +