Skip to content

Commit

Permalink
Test for firewalld container in ALP product
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmanzo committed Nov 15, 2023
1 parent 51247a8 commit 53b5fc4
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
15 changes: 15 additions & 0 deletions schedule/alp/firewalld_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
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
- network/setup_multimachine.pm
- '{{firewalld_container}}'
37 changes: 37 additions & 0 deletions tests/microos/workloads/firewalld-container/firewalld_client.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 <[email protected]>

use base "consoletest";
use warnings;
use strict;
use testapi;
use serial_terminal 'select_serial_terminal';
use lockapi;

sub run {
my ($self) = @_;
#select_serial_terminal;
select_console 'root-console';
mutex_create 'barrier_setup_done';
mutex_wait 'barrier_setup_done';

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;

50 changes: 50 additions & 0 deletions tests/microos/workloads/firewalld-container/firewalld_server.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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 <[email protected]>

use base "consoletest";
use warnings;
use strict;
use testapi;
use serial_terminal 'select_serial_terminal';
use lockapi;

sub run {
my ($self) = @_;
mutex_create 'barrier_setup_done';
mutex_lock 'barrier_setup_done';
barrier_create($_, 2) for qw(FIREWALLD_SERVER_READY FIREWALLD_SERVER_PORT_CLOSED FIREWALLD_SERVER_FINISHED);
mutex_unlock 'barrier_setup_done';
#select_serial_terminal;
select_console 'root-console';
my $hostname = get_var('HOSTNAME');
record_info("1 server ip a", script_output("ip a"));
# install software
barrier_wait 'FIREWALLD_SERVER_READY';
# setup MM networking
# 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_run_hook {
cleanup();
}

sub post_fail_hook {
cleanup();
}

sub cleanup {
barrier_destroy($_) for qw(FIREWALLD_SERVER_READY FIREWALLD_SERVER_PORT_CLOSED FIREWALLD_SERVER_FINISHED);
}

1;

0 comments on commit 53b5fc4

Please sign in to comment.