Skip to content

Commit

Permalink
Merge pull request #14150 from DeepthiYV/autofs
Browse files Browse the repository at this point in the history
Fix autofs test
  • Loading branch information
tjyrinki committed Feb 4, 2022
2 parents 6e8480a + 805bed7 commit 53748fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/autofs_utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ my $test_mount_dir = '/mnt/test_autofs_local';
my $file_to_mount = '/tmp/test-iso.iso';
my $test_conf_file_content = "iso -fstype=auto,ro :$file_to_mount";
my $service_type = 'Systemd';
my $autofs_sys_conf_file = '/etc/sysconfig/autofs';

=head2 setup_autofs_server
Expand All @@ -42,6 +43,7 @@ sub setup_autofs_server {
assert_script_run("grep '$args{test_conf_file}' $args{autofs_map_file}");
assert_script_run("echo $args{test_conf_file_content} > $args{test_conf_file}", fail_message => "File $args{test_conf_file} could not be created");
assert_script_run("grep '$args{test_conf_file_content}' $args{test_conf_file}");
assert_script_run(q{sed -i_bk 's|AUTOFS_OPTIONS=""|AUTOFS_OPTIONS="--debug"|' } . $autofs_sys_conf_file);
}

=head2 check_autofs_service
Expand Down
6 changes: 3 additions & 3 deletions tests/network/autofs_client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use testapi;
use lockapi;
use autofs_utils qw(setup_autofs_server check_autofs_service);
use utils 'systemctl';
use version_utils 'is_opensuse';
use strict;
use warnings;

Expand All @@ -55,7 +56,7 @@ sub run {
my $test_conf_file = '/etc/auto.share';
my $test_mount_dir = '/mnt/test';
my $test_mount_dir_nfsidmap = '/mnt/test_nfsidmap';
my $test_conf_file_content = "test -ro,no_subtree_check $nfs_server:$remote_mount";
my $test_conf_file_content = "test -ro $nfs_server:$remote_mount";

# autofs
check_autofs_service();
Expand All @@ -64,7 +65,7 @@ sub run {
validate_script_output("systemctl --no-pager status autofs", sub { m/Active:\s*active/ }, 180);

# nfsidmap
assert_script_run("rpm -q nfsidmap");
is_opensuse ? assert_script_run("rpm -q libnfsidmap1") : assert_script_run("rpm -q nfsidmap");
# Allow failing, it's to clear the keyring if one exists
assert_script_run("nfsidmap -c || true");
assert_script_run("mkdir -p $test_mount_dir_nfsidmap");
Expand All @@ -91,7 +92,6 @@ sub run {
validate_script_output("ls -l $test_mount_dir_nfsidmap/tux.txt", sub { m/tux.*users.*tux.txt/ });
validate_script_output("cat $test_mount_dir_nfsidmap/tux.txt", sub { m/Hi tux/ });
assert_script_run("umount $test_mount_dir_nfsidmap");

barrier_wait 'AUTOFS_FINISHED';
}

Expand Down
5 changes: 3 additions & 2 deletions tests/network/autofs_server.pm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ sub run {
zypper_call('modifyrepo -e 1');
zypper_call('ref');
}

# autofs
zypper_call('in nfs-kernel-server');
assert_script_run "mkdir -p $test_share_dir";
Expand All @@ -60,10 +61,11 @@ sub run {

# nfsidmap
assert_script_run "echo N > /sys/module/nfsd/parameters/nfs4_disable_idmapping";
zypper_call('in nfsidmap');
is_opensuse ? zypper_call('in libnfsidmap1') : zypper_call('in nfsidmap');
systemctl 'restart nfs-idmapd';
assert_script_run "nfsidmap -c || true";
assert_script_run "useradd -m tux";
assert_script_run "chmod -R 755 $nfsidmap_share_dir";
assert_script_run "echo Hi tux > $nfsidmap_share_dir/tux.txt";
assert_script_run "chown tux:users $nfsidmap_share_dir/tux.txt";
assert_script_run "echo '/home/tux *(ro)' >> /etc/exports";
Expand All @@ -74,5 +76,4 @@ sub run {
barrier_wait 'AUTOFS_SUITE_READY';
barrier_wait 'AUTOFS_FINISHED';
}

1;

0 comments on commit 53748fd

Please sign in to comment.