1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-08 00:44:20 +00:00
os-autoinst-distri-fedora/tests/_iot_zezere_remote.pm
Adam Williamson aa41fe4e4e Automate QA:Testcase_Zezere_Ignition
This is a bit complex to automate, because we cannot really use
the production Zezere server (provision.fedoraproject.org) as
the test case shows, as we'd have to solve authentication and
we also don't really want to constantly keep registering new
hosts to it that are going to disappear and never be seen again.

So, instead we'll do it by setting up our *own* Zezere, and
provisioning our IoT system in that. We run two tests. The
'ignition' test is the actual IoT 'device'; all it really does
is boot up, sit around, and wait to be provisioned. The 'server'
test first sets up a Zezere server, then logs into it, adds an
ssh key, claims the IoT device, provisions it, and connects to
it to create a special file which tells the 'ignition' test
everything worked and it can close out.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-07-23 18:01:06 -07:00

59 lines
1.5 KiB
Perl

use base "installedtest";
use strict;
use lockapi;
use testapi;
use utils;
sub run {
my $self = shift;
# set up an ssh key
type_string "ssh-keygen\n";
sleep 2;
# confirm directory
send_key "ret";
sleep 2;
# empty passphrase
send_key "ret";
sleep 2;
# confirm empty passphrase
send_key "ret";
my $sshpub = script_output "cat /root/.ssh/id_rsa.pub";
# launch Firefox
type_string "startx /usr/bin/firefox -width 1024 -height 768 http://172.16.2.118\n";
# log in as admin
assert_screen "zezere_login";
type_string "admin";
send_key "tab";
type_string "weakpassword\n";
# add our ssh key
assert_and_click "zezere_ssh_key";
assert_and_click "zezere_ssh_key_contents";
type_string "$sshpub";
send_key "tab";
send_key "ret";
# claim the device
assert_and_click "zezere_claim_unowned";
assert_and_click "zezere_claim_button";
# provision it
assert_and_click "zezere_device_management";
assert_and_click "zezere_submit_provision";
assert_and_click "zezere_provision_menu";
send_key_until_needlematch("zezere_provision_installed", "down", 3, 3);
assert_and_click "zezere_provision_schedule";
# exit
quit_firefox;
# wait for the provision request to go through
sleep 30;
# ssh into iot host and create key file
assert_script_run 'ssh -o StrictHostKeyChecking=no root@172.16.2.119 touch /tmp/zezerekeyfile';
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et: