Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AutoYaST nfs share test suite #9478

Merged
merged 1 commit into from Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
220 changes: 220 additions & 0 deletions data/autoyast_sle15/autoyast_nfs_share.xml
@@ -0,0 +1,220 @@
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<suse_register>
<do_registration config:type="boolean">true</do_registration>
<email/>
<reg_code>{{SCC_REGCODE}}</reg_code>
<install_updates config:type="boolean">true</install_updates>
<reg_server>{{SCC_URL}}</reg_server>
<addons config:type="list">
<addon>
<name>sle-module-basesystem</name>
<version>{{VERSION}}</version>
<arch>{{ARCH}}</arch>
</addon>
<addon>
<name>sle-module-server-applications</name>
<version>{{VERSION}}</version>
<arch>{{ARCH}}</arch>
</addon>
</addons>
</suse_register>
<bootloader>
<global>
<timeout config:type="integer">-1</timeout>
</global>
<loader_type>grub2</loader_type>
</bootloader>
<general>
<mode>
<confirm config:type="boolean">false</confirm>
</mode>
</general>
<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
</networking>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>Bernhard M. Wiedemann</fullname>
<gid>100</gid>
<home>/home/bernhard</home>
<password_settings>
<expire/>
<flag/>
<inact>-1</inact>
<max>99999</max>
<min>0</min>
<warn>7</warn>
</password_settings>
<shell>/bin/bash</shell>
<uid>1000</uid>
<user_password>nots3cr3t</user_password>
<username>bernhard</username>
</user>
<user>
<encrypted config:type="boolean">false</encrypted>
<fullname>root</fullname>
<gid>0</gid>
<home>/root</home>
<password_settings>
<expire/>
<flag/>
<inact/>
<max/>
<min/>
<warn/>
</password_settings>
<shell>/bin/bash</shell>
<uid>0</uid>
<user_password>nots3cr3t</user_password>
<username>root</username>
</user>
</users>
<partitioning config:type="list">
<drive>
<device>/dev/vda</device>
<disklabel>gpt</disklabel>
<enable_snapshots config:type="boolean">true</enable_snapshots>
<initialize config:type="boolean">false</initialize>
<partitions config:type="list">
<partition>
<create config:type="boolean">true</create>
<format config:type="boolean">false</format>
<partition_id config:type="integer">263</partition_id>
<partition_nr config:type="integer">1</partition_nr>
<resize config:type="boolean">false</resize>
<size>8388608</size>
</partition>
<partition>
<create config:type="boolean">true</create>
<create_subvolumes config:type="boolean">true</create_subvolumes>
<filesystem config:type="symbol">btrfs</filesystem>
<format config:type="boolean">true</format>
<mount>/</mount>
<mountby config:type="symbol">uuid</mountby>
<partition_id config:type="integer">131</partition_id>
<partition_nr config:type="integer">2</partition_nr>
<resize config:type="boolean">false</resize>
<size>30054285312</size>
<subvolumes config:type="list">
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>opt</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>tmp</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>boot/grub2/i386-pc</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>boot/grub2/x86_64-efi</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">false</copy_on_write>
<path>var</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>root</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>home</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>srv</path>
</subvolume>
<subvolume>
<copy_on_write config:type="boolean">true</copy_on_write>
<path>usr/local</path>
</subvolume>
</subvolumes>
<subvolumes_prefix><![CDATA[@]]></subvolumes_prefix>
</partition>
<partition>
<create config:type="boolean">true</create>
<filesystem config:type="symbol">swap</filesystem>
<format config:type="boolean">true</format>
<mount>swap</mount>
<mountby config:type="symbol">uuid</mountby>
<partition_id config:type="integer">130</partition_id>
<partition_nr config:type="integer">3</partition_nr>
<resize config:type="boolean">false</resize>
<size>2148515328</size>
</partition>
</partitions>
<type config:type="symbol">CT_DISK</type>
<use>all</use>
</drive>
<drive>
<device>openqa.suse.de:/var/lib/openqa/share</device>
<disklabel>none</disklabel>
<initialize config:type="boolean">false</initialize>
<partitions config:type="list">
<partition>
<create config:type="boolean">false</create>
<mount>/test</mount>
<mountby config:type="symbol">device</mountby>
<resize config:type="boolean">false</resize>
</partition>
</partitions>
<type config:type="symbol">CT_NFS</type>
<use>all</use>
</drive>
</partitioning>
<report>
<errors>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</errors>
<messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</messages>
<warnings>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</warnings>
<yesno_messages>
<log config:type="boolean">true</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">0</timeout>
</yesno_messages>
</report>
<services-manager>
<services>
<disable config:type="list"/>
<enable config:type="list">
<service>nfs</service>
<service>rpc-statd</service>
<service>rpcbind</service>
</enable>
</services>
</services-manager>
<software>
<packages config:type="list">
<package>sle-module-server-applications-release</package>
<package>sle-module-basesystem-release</package>
</packages>
<patterns config:type="list">
<pattern>apparmor</pattern>
<pattern>base</pattern>
<pattern>basesystem</pattern>
<pattern>enhanced_base</pattern>
<pattern>minimal_base</pattern>
</patterns>
<products config:type="list">
<product>SLES</product>
</products>
</software>
</profile>
41 changes: 41 additions & 0 deletions schedule/yast/autoyast_nfs_share.yaml
@@ -0,0 +1,41 @@
name: autoyast_multi_btrfs
description: >
Test autoyast installation, while using nfs share
schedule:
- autoyast/prepare_profile
- installation/isosize
- installation/bootloader_start
- autoyast/installation
- installation/first_boot
- autoyast/console
- autoyast/clone
- autoyast/verify_cloned_profile
- autoyast/verify_nfs_share
test_data:
# cmd validation
server: openqa.suse.de
remote_dir: /var/lib/openqa/share
mount: /test
fs_type: nfs
services:
- rpcbind
- rpc-statd
- nfs
services_status: active
# cloned AutoYaST profile validation
profile:
partitioning:
drive:
unique_key: device
device: openqa.suse.de:/var/lib/openqa/share
disklabel: none
partitions:
- partition:
unique_key: mount
create: false
mount: /test
type: CT_NFS
services-manager:
services:
enable:
service: nfs
58 changes: 58 additions & 0 deletions tests/autoyast/verify_nfs_share.pm
@@ -0,0 +1,58 @@
# SUSE's openQA tests
#
# Copyright © 2020 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# Summary: Validate nfs share is mounted after is enabled in AutoYaST installation.
# Maintainer: Joaquín Rivera <jeriveramoya@suse.com>

use strict;
use warnings;
use testapi;
use base 'basetest';
use scheduler 'get_test_suite_data';
use Test::Assert ':all';

sub check_nfs_server {
my $data = shift;
my $expected = "$data->{remote_dir} *";
record_info('showmount', 'Check export list for server');
my $actual = script_output("showmount -e --no-headers $data->{server}");
assert_equals($expected, $actual);
}

sub validate_services {
my $data = shift;
for my $service (@{$data->{services}}) {
assert_script_run("systemctl status --no-pager $service.service",
sub { m/Active: $data->{services_status}/ });
}
}

sub validate_mount_point {
my $data = shift;
my $expected =
qr/$data->{server}:$data->{remote_dir}\s+$data->{mount}\s+$data->{fs_type}\s+defaults\s+0\s+0/;
record_info('fstab', 'Check /etc/fstab');
my $actual = script_output("grep $data->{server}:$data->{remote_dir} /etc/fstab");
assert_matches($expected, $actual);

record_info('mount', 'Check mount point');
assert_script_run("mount -l | grep $data->{fs_type}");

record_info('ls', "Check mount point is not empty");
assert_script_run("[ \"$(ls $data->{mount})\" ]");
}

sub run {
my $test_data = get_test_suite_data();
check_nfs_server($test_data);
validate_services($test_data);
validate_mount_point($test_data);
}

1;