diff options
author | vmallika <vmallika@redhat.com> | 2015-02-19 17:54:03 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-02-23 22:46:56 -0800 |
commit | a46325cd37806a8e9d1abbb121d4e854799042ae (patch) | |
tree | d9e9401f67842a00e1da22fd6537d95eec56d125 /tests | |
parent | 21cf6ac8b852a04ded1e5399240292d0795035f6 (diff) |
Fix for test uss.t and bug-1167580-set-proper-uid-and-gid-during-nfs-access.t
testcase uss.t and
bug-1167580-set-proper-uid-and-gid-during-nfs-access.t
uses below method to generate random string
cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 8 | head -n 1
Doing a cat on /dev/urandom can consume more CPU usage.
Change to:
uuidgen | tr -dc 'a-zA-Z' | head -c 8
Backport of http://review.gluster.org/#/c/9703/
Change-Id: Id08ec47e39b12f956e266d30cc5327b5b70c2fb0
Reviewed-on: http://review.gluster.org/9728
BUG: 1165938
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-by: Justin Clift <justin@gluster.org>
Tested-by: Justin Clift <justin@gluster.org>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/uss.t | 2 | ||||
-rw-r--r-- | tests/bugs/bug-1167580-set-proper-uid-and-gid-during-nfs-access.t | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t index a90919ca0f6..eeccb28be05 100644 --- a/tests/basic/uss.t +++ b/tests/basic/uss.t @@ -54,7 +54,7 @@ TEST $CLI snapshot create snap4 $V0; ## Test that features.uss takes only options enable/disable and throw error for ## any other argument. for i in {1..10}; do - RANDOM_STRING=`cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 8 | head -n 1` + RANDOM_STRING=$(uuidgen | tr -dc 'a-zA-Z' | head -c 8) TEST_IN_LOOP ! $CLI volume set $V0 features.uss $RANDOM_STRING done diff --git a/tests/bugs/bug-1167580-set-proper-uid-and-gid-during-nfs-access.t b/tests/bugs/bug-1167580-set-proper-uid-and-gid-during-nfs-access.t index 1eb3d55e36c..046a53bff40 100644 --- a/tests/bugs/bug-1167580-set-proper-uid-and-gid-during-nfs-access.t +++ b/tests/bugs/bug-1167580-set-proper-uid-and-gid-during-nfs-access.t @@ -38,12 +38,11 @@ function check_if_permitted () { # Create a directory in /tmp to specify which directory to make # as home directory for user -home_dir=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 8 | head -n 1) -home_dir="/tmp/bug-1167580-$home_dir" -mkdir $home_dir +home_dir=$(mktemp -d) +chmod 777 $home_dir function get_new_user() { - local temp=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 8 | head -n 1) + local temp=$(uuidgen | tr -dc 'a-zA-Z' | head -c 8) id $temp if [ "$?" == "0" ] then @@ -59,9 +58,9 @@ function create_user() { if [ "$group" == "" ] then - useradd -d $home_dir/$user $user + /usr/sbin/useradd -d $home_dir/$user $user else - useradd -d $home_dir/$user -G $group $user + /usr/sbin/useradd -d $home_dir/$user -G $group $user fi return $? |