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 21, 2023
1 parent 8f86a67 commit d58af67
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
16 changes: 16 additions & 0 deletions schedule/alp/firewalld_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
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

Check failure on line 14 in schedule/alp/firewalld_container.yaml

View workflow job for this annotation

GitHub Actions / CI: Running static tests with perl v5.32

14:36 [trailing-spaces] trailing spaces
- microos/networking.pm
- '{{firewalld_container}}'
38 changes: 38 additions & 0 deletions tests/microos/workloads/firewalld-container/firewalld_client.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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) = @_;
select_serial_terminal;
mutex_wait 'server'; # [debug] [pid:109623] mutex lock 'server' unavailable, sleeping 5 seconds
record_info("1 client ip a", script_output("ip a"));
#die unless server_port_is_open();
#die unless server_port_is_closed();
}

1;

51 changes: 51 additions & 0 deletions tests/microos/workloads/firewalld-container/firewalld_server.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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;
use mmapi;

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 'server';
#select_serial_terminal;
select_console 'root-console';
my $containerpath = 'registry.opensuse.org/suse/alp/workloads/tumbleweed_images/suse/alp/workloads/firewalld';
my $hostname = get_var('HOSTNAME');
# 1. transactional-update pkg remove firewalld
# 2. reboot\
# 3. podman container runlabel install $containerpath
# 4. podman container runlabel run $containerpath
# 5. /usr/local/bin/firewall-cmd is a wrapper to call the firewall-cmd inside the container. Docker and Podman are supported.
# or podman exec firewalld firewall-cmd OPTIONS

# install_firewalld_container();
# close_firewall_port();
# mutex_unlock 'server';
# mutex_wait 'client';
# record_info("2 server ip a", script_output("ip a"));
sleep 600; # fake sleep to simulate operations and make client do its work
wait_for_children();
}

1;

0 comments on commit d58af67

Please sign in to comment.