#176 Automate QA:Testcase_RpmOstree_Package_Layering
Merged 4 years ago by adamwill. Opened 4 years ago by lruzicka.

file modified
+13
@@ -1505,6 +1505,19 @@ 

                  "START_AFTER_TEST": "install_default_upload"

              }

          },

+         "iot_rpmostree_overlay": {

+             "profiles": {

+                 "fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,

+                 "fedora-IoT-dvd_ostree-iso-x86_64-*-64bit": 20

+             },

+             "settings": {

+                 "BOOTFROM": "c",

+                 "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",

+                 "POSTINSTALL": "iot_rpmostree_overlay",

+                 "ROOT_PASSWORD": "weakpassword",

+                 "START_AFTER_TEST": "install_default_upload"

+             }

+         },

          "mediakit_fileconflicts": {

              "profiles": {

                  "fedora-Server-dvd-iso-aarch64-*-aarch64": 10,

@@ -0,0 +1,81 @@ 

+ use base "installedtest";

+ use strict;

+ use testapi;

+ use utils;

+ 

+ sub reboot_and_login {

+     # This subroutine reboots the host, waits out the boot process and logs in.

+     my $reboot_time = shift;

+     script_run "systemctl reboot";

+     boot_to_login_screen(timeout => $reboot_time);

+     console_login(user=>"root", password=>get_var("ROOT_PASSWORD"));

+     sleep 2;

+ }

+ 

+ sub run {

+     my $self = shift;

+     my $reboot_time = 300;

+     # switch to TTY3 for both, graphical and console tests

+     $self->root_console(tty=>3);

+ 

+     # Install wget as rpm-ostree overlay. Let's have timeout defined

+     # quite generously, because it loads the package DBs.

+     assert_script_run "rpm-ostree install wget", timeout => 300;

+     # Reboot the machine to boot into the overlayed tree.

+     reboot_and_login "300";

+     

+     # Check that wget rpm is installed

+     assert_script_run "rpm -q wget";

+     # And that it works

+     assert_script_run "wget --version";

+ 

+     # Then install the httpd package.

+     assert_script_run "rpm-ostree install httpd", timeout => 300;

+     

+     # Reboot the machine to boot into the overlayed tree.

+     reboot_and_login "300";

+ 

+     # Check for new as well as old overlays

+     assert_script_run "rpm -q wget";

+     assert_script_run "rpm -q httpd";

+     assert_script_run "rpm -q apr";

+ 

+     # Start the httpd.service and check for its status

+     assert_script_run "systemctl start httpd";

+     assert_script_run "systemctl is-active httpd";

+ 

+     # Check for the functional test page

+     assert_script_run "curl -o page.html http://localhost";

+     assert_script_run "grep 'Fedora Project' page.html"; 

+ 

+     # Enable the httpd service

+     assert_script_run "systemctl enable httpd";

+ 

+     # Reboot the computer to boot check if the service has been enabled and starts

+     # automatically.

+     reboot_and_login "300";

+ 

+     # See if httpd is started

+     assert_script_run "systemctl is-active httpd";

+ 

+     # Uninstall wget and httpd again.

+     assert_script_run "rpm-ostree uninstall wget httpd";

+ 

+     # Reboot to see the changed tree

+     reboot_and_login "300";

+ 

+     # Check if wget and httpd were removed and no longer can be used.

+     assert_script_run "! rpm -q wget";

+     assert_script_run "! rpm -q httpd";

+     assert_script_run "! wget --version";

+     assert_script_run "! systemctl is-active httpd";

+ 

+ }

+ 

+ sub test_flags {

+     return { fatal => 1 };

+ }

+ 

+ 1;

+ 

+ # vim: set sw=4 et:

This test tests that rpms could be layered using os-tree in IoT and FIXES #168.

1 new commit added

  • Add to templates.
4 years ago

Build succeeded.

I tested this PR on Fedora IoT 32, because due to a bug (https://bugzilla.redhat.com/show_bug.cgi?id=1838691), this cannot be tested on Fedora IoT Rawhide yet.

grep 'Fedora Project' page.html works fine, you know :D

there's a systemctl is-active you can use here which should be safer than relying on the output of systemctl status. See the base_service_manipulation.pm test for examples.

systemctl is-active here again.

all the above can be improved with the handy bash-ism !, I believe. try e.g. assert_script_run "! rpm -q wget". this will be particularly handy for the last two, because as things stand they are not actually testing anything.

can you address the line-by-line comments and squash this down to a single commit? thanks!

Metadata Update from @adamwill:
- Request assigned

4 years ago

1 new commit added

  • Fix after review.
4 years ago

Build succeeded.

4 new commits added

  • Create a test for rpm-ostree overlays.
  • Delete needle as required by the review.
  • Create IOT needle directory and move needles in it.
  • Finish test and add necessary needles.
4 years ago

Build succeeded.

rebased onto 7ba5bc7e3175779ec7cfd18fec94f0f66c22e252

4 years ago

rebased onto 8c40583

4 years ago

Build succeeded.

OK, looking good. Thanks!

Pull-Request has been merged by adamwill

4 years ago