forked from os-autoinst/os-autoinst-distri-opensuse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for firewalld container in ALP product
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
- microos/networking.pm | ||
- '{{firewalld_container}}' |
38 changes: 38 additions & 0 deletions
38
tests/microos/workloads/firewalld-container/firewalld_client.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
51
tests/microos/workloads/firewalld-container/firewalld_server.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|