summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2015-03-19 15:15:07 -0400
committerVijay Bellur <vbellur@redhat.com>2015-03-30 23:41:29 -0700
commitd3eacb0d83834db485061d875d95b4f6af41f30a (patch)
tree53ad760809a10b0d9aa245980441b10312368d23
parentf9ee09abd29002d8612bcdcbeaf4cf3e404b4cc6 (diff)
tests: fix online_brick_count
It turns out that "pidof" is unreliable on some platforms (e.g. Fedora 21) because it will show spurious entries for processes using the same inode under a different name. Use "pgrep" instead because it's name-based and doesn't get confused by glusterd/glusterfs being links to glusterfsd. Also changed bug-913555.t because it had the same mistake in its own version of the same function. Now it uses the common version. Change-Id: I5d70edd5655faa5470e0f378b8c16a6adacbd4b4 BUG: 1163543 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/9948 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xtests/bugs/glusterd/bug-913555.t12
-rw-r--r--tests/volume.rc2
2 files changed, 5 insertions, 9 deletions
diff --git a/tests/bugs/glusterd/bug-913555.t b/tests/bugs/glusterd/bug-913555.t
index 4f9e004a654..0bc839e316d 100755
--- a/tests/bugs/glusterd/bug-913555.t
+++ b/tests/bugs/glusterd/bug-913555.t
@@ -16,10 +16,6 @@ function check_peers {
$CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
}
-function glusterfsd_count {
- pidof glusterfsd | wc -w;
-}
-
cleanup;
TEST launch_cluster 3; # start 3-node virtual cluster
@@ -37,18 +33,18 @@ TEST glusterfs --volfile-server=$H1 --volfile-id=$V0 $M0
TEST kill_node 3;
EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers;
EXPECT 0 check_fs $M0;
-EXPECT 2 glusterfsd_count;
+EXPECT 2 online_brick_count;
# Kill another pseudo-node, make sure the last one dies and volume goes down.
TEST kill_node 2;
EXPECT_WITHIN $PROBE_TIMEOUT 0 check_peers
EXPECT 1 check_fs $M0;
-EXPECT 0 glusterfsd_count; # the two glusterfsds of the other two glusterds
- # must be dead
+EXPECT 0 online_brick_count; # the two glusterfsds of the other two glusterds
+ # must be dead
TEST $glusterd_2;
TEST $glusterd_3;
-EXPECT_WITHIN $PROCESS_UP_TIMEOUT 3 glusterfsd_count; # restore quorum, all ok
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 3 online_brick_count; # restore quorum, all ok
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 0 check_fs $M0;
cleanup
diff --git a/tests/volume.rc b/tests/volume.rc
index ac078e2bcce..741d2b81c15 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -16,7 +16,7 @@ function brick_count()
function online_brick_count ()
{
- pidof glusterfsd | wc -w
+ pgrep glusterfsd | wc -l
}
function volume_option()