-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare two synchronized machines to test PCW
PCW is executed in a microos and is setup using ansible. This PR creates the environment for two VMs to test the ansible playbooks and selenium tests. The microos is ready with all the needed packages. https://progress.opensuse.org/issues/130144
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
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,3 @@ | ||
PubkeyAuthentication yes | ||
PermitRootLogin yes | ||
AuthorizedKeysFile .ssh/authorized_keys |
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
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,37 @@ | ||
use base "consoletest"; | ||
use serial_terminal 'select_serial_terminal'; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
use mmapi; | ||
use utils qw(zypper_call); | ||
use network_utils qw(setup_static_network); | ||
use lockapi; | ||
|
||
sub run { | ||
my ($self, $args) = @_; | ||
select_serial_terminal; | ||
|
||
record_info('system', script_output('cat /etc/os-release')); | ||
setup_static_network(ip => '10.0.2.15/15', gw => '10.0.2.2', iface => 'eth0'); | ||
assert_script_run('echo "10.0.2.20 microos" >> /etc/hosts'); | ||
zypper_call('in -y iputils git'); | ||
|
||
assert_script_run('mkdir /root/.ssh'); | ||
assert_script_run('curl -f -v ' . autoinst_url . '/data/slenkins/ssh/id_rsa > /root/.ssh/id_rsa'); | ||
assert_script_run('chmod 600 /root/.ssh/id_rsa'); | ||
|
||
my $children = get_children(); | ||
my $child_id = (keys %$children)[0]; | ||
mutex_wait('target_is_ready', $child_id); | ||
|
||
# Testing target is accessible | ||
assert_script_run('ping -c 1 microos'); | ||
assert_script_run('ssh -v -o StrictHostKeyChecking=accept-new -o KexAlgorithms=ecdh-sha2-nistp521 root@microos hostname'); | ||
|
||
mutex_create 'job_completed'; | ||
|
||
wait_for_children; | ||
} | ||
|
||
1; |
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,47 @@ | ||
use base "consoletest"; | ||
use serial_terminal 'select_serial_terminal'; | ||
use transactional qw(process_reboot); | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
use lockapi; | ||
use mm_network qw(setup_static_mm_network); | ||
|
||
sub run { | ||
my ($self, $args) = @_; | ||
select_serial_terminal; | ||
record_info('system', script_output('cat /etc/os-release')); | ||
record_info('device', script_output('nmcli -t device')); | ||
|
||
# my $device = 'ens4'; | ||
|
||
# assert_script_run('nmcli con add type ethernet con-name "static-ip" ifname ens4 ipv4.method manual ipv4.addresses 10.0.2.20/15 gw4 10.0.2.2'); | ||
# assert_script_run('nmcli con mod static-ip ipv4.dns "10.136.53.53,10.136.53.54,10.100.2.10"'); | ||
|
||
# configure_static_ip(ip => $static_ip, ); | ||
# configure_default_gateway(device => $device) | ||
setup_static_mm_network(ip => '10.0.2.20/15'); | ||
|
||
assert_script_run('nmcli con up static-ip ifname ens4'); | ||
record_info('ip', script_output('ip a')); | ||
script_run('ping -c 1 10.0.2.15'); | ||
script_run('ping -c 1 download.suse.de'); | ||
|
||
assert_script_run('curl -f -v ' . autoinst_url . '/data/slenkins/ssh/authorized_keys >> /root/.ssh/authorized_keys'); | ||
assert_script_run('curl -f -v ' . autoinst_url . '/data/publiccloud/pcw/sshd_config >/etc/ssh/sshd_config'); | ||
|
||
assert_script_run('zypper ar http://download.suse.de/ibs/SUSE:/CA/openSUSE_Tumbleweed/ SUSE_CA'); | ||
assert_script_run('zypper --gpg-auto-import-keys ref'); | ||
assert_script_run('transactional-update -n -c pkg install ca-certificates-suse htop iftop iotop atop telnet nmap jq git rsync wget parted tcpdump screen sqlite3 fortune iputils nginx dehydrated dehydrated-nginx podman podman-cni-config cockpit cockpit-podman toolbox python3-selinux'); | ||
process_reboot(trigger => 1); | ||
|
||
script_run('systemctl restart sshd'); | ||
sleep 10; | ||
assert_script_run('systemctl status sshd'); | ||
mutex_create 'target_is_ready'; | ||
|
||
assert_script_run('ping -c 1 10.0.2.15'); | ||
mutex_wait 'job_completed'; | ||
} | ||
|
||
1; |