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 afa25ff
Show file tree
Hide file tree
Showing 3 changed files with 117 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}}'
56 changes: 56 additions & 0 deletions tests/microos/workloads/firewalld-container/firewalld_client.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 server_port_is_open {
record_info("CLIENT DEBUG", "test if port is open");
return 1;
}

sub server_port_is_closed {
record_info("CLIENT DEBUG", "test if port is closed");
return 1;
}


sub run {
my ($self) = @_;
mutex_create 'client';
mutex_create 'server';
select_serial_terminal;
record_info("1 client ip a", script_output("ip a"));
mutex_wait 'server';
record_info("2 client ip a", script_output("ip a"));
# server port should be reachable
mutex_lock 'client';
die unless server_port_is_open();
mutex_unlock 'client';
mutex_wait 'server';
mutex_lock 'client';
die unless server_port_is_closed();
mutex_unlock 'client';
mutex_wait 'server';
}

sub post_fail_hook {
mutex_unlock 'client_test_done';
}

sub post_run_hook {
mutex_unlock 'client_test_done';
}

1;

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

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

sub install_firewalld_container {
record_info("SERVER DEBUG", "installing firewalld container");
}

sub close_firewall_port {
record_info("SERVER DEBUG", "closing firewall port");
}


sub run {
my ($self) = @_;
mutex_create 'client';
mutex_create 'server';
mutex_lock 'server';
#select_serial_terminal;
select_console 'root-console';
my $hostname = get_var('HOSTNAME');
record_info("1 server ip a", script_output("ip a"));
install_firewalld_container();
mutex_unlock 'server';
mutex_wait 'client';
mutex_lock 'server';
close_firewall_port();
mutex_unlock 'server';
mutex_wait 'client';
record_info("2 server ip a", script_output("ip a"));
}

1;

0 comments on commit afa25ff

Please sign in to comment.