diff options
Diffstat (limited to 'tests/bugs/cli')
| -rw-r--r-- | tests/bugs/cli/bug-1022905.t | 1 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1169302.c | 79 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-1169302.t | 55 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-1320388.t | 6 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1353156-get-state-cli-validations.t | 147 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1378842-volume-get-all.t | 23 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-770655.t | 168 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-822830.t | 2 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-961307.t | 2 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-983317-volume-get.t | 13 |
10 files changed, 322 insertions, 174 deletions
diff --git a/tests/bugs/cli/bug-1022905.t b/tests/bugs/cli/bug-1022905.t index 1d8981e0e9c..ee629e970d9 100644 --- a/tests/bugs/cli/bug-1022905.t +++ b/tests/bugs/cli/bug-1022905.t @@ -32,7 +32,6 @@ TEST $CLI volume set $V0 diagnostics.client-log-level DEBUG TEST $CLI volume reset $V0 force; TEST $CLI volume stop $V0 -EXPECT "1" get_aux TEST $CLI volume delete $V0 cleanup; diff --git a/tests/bugs/cli/bug-1169302.c b/tests/bugs/cli/bug-1169302.c new file mode 100644 index 00000000000..7c6b5fbf856 --- /dev/null +++ b/tests/bugs/cli/bug-1169302.c @@ -0,0 +1,79 @@ +#include <errno.h> +#include <stdio.h> +#include <signal.h> + +#include <glusterfs/api/glfs.h> +#include <glusterfs/api/glfs-handles.h> + +int keep_running = 1; + +void +stop_running(int sig) +{ + if (sig == SIGTERM) + keep_running = 0; +} + +int +main(int argc, char *argv[]) +{ + glfs_t *fs = NULL; + int ret = 0; + glfs_fd_t *fd = NULL; + char *filename = NULL; + char *logfile = NULL; + char *host = NULL; + + if (argc != 5) { + return -1; + } + + host = argv[2]; + logfile = argv[3]; + filename = argv[4]; + + /* setup signal handler for exiting */ + signal(SIGTERM, stop_running); + + fs = glfs_new(argv[1]); + if (!fs) { + return -1; + } + + ret = glfs_set_volfile_server(fs, "tcp", host, 24007); + if (ret < 0) { + return -1; + } + + ret = glfs_set_logging(fs, logfile, 7); + if (ret < 0) { + return -1; + } + + ret = glfs_init(fs); + if (ret < 0) { + return -1; + } + + fd = glfs_creat(fs, filename, O_RDWR, 0644); + if (!fd) { + return -1; + } + + /* sleep until SIGTERM has been received */ + while (keep_running) { + sleep(1); + } + + ret = glfs_close(fd); + if (ret < 0) { + return -1; + } + + ret = glfs_fini(fs); + if (ret < 0) { + return -1; + } + + return 0; +} diff --git a/tests/bugs/cli/bug-1169302.t b/tests/bugs/cli/bug-1169302.t new file mode 100755 index 00000000000..19660e033a8 --- /dev/null +++ b/tests/bugs/cli/bug-1169302.t @@ -0,0 +1,55 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../cluster.rc + +function check_peers { + $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l +} +cleanup + +#setup cluster and test volume +TEST launch_cluster 3; # start 3-node virtual cluster +TEST $CLI_1 peer probe $H2; # peer probe server 2 from server 1 cli +TEST $CLI_1 peer probe $H3; # peer probe server 3 from server 1 cli + +EXPECT_WITHIN $PROBE_TIMEOUT 2 check_peers; + +TEST $CLI_1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0 $H3:$B3/$V0 +TEST $CLI_1 volume start $V0 + +# test CLI parameter acceptance +TEST $CLI_1 volume statedump $V0 +TEST $CLI_2 volume statedump $V0 +TEST $CLI_3 volume statedump $V0 +TEST ! $CLI_1 volume statedump $V0 client $H2:0 +TEST ! $CLI_2 volume statedump $V0 client $H2:-1 +TEST $CLI_3 volume statedump $V0 client $H2:765 +TEST ! $CLI_1 volume statedump $V0 client $H2: +TEST ! $CLI_2 volume statedump $V0 client +TEST ! $CLI_3 volume statedump $V0 client $H2 $GFAPI_PID + +# build and run a gfapi appliction for triggering a statedump +logdir=`gluster --print-logdir` +STATEDUMP_TIMEOUT=60 + +build_tester $(dirname $0)/bug-1169302.c -lgfapi +$(dirname $0)/bug-1169302 $V0 $H1 $logdir/bug-1169302.log testfile & GFAPI_PID=$! + +cleanup_statedump + +# Take the statedump of the process connected to $H1, it should match the +# hostname or IP-address with the connection from the bug-1169302 executable. +# In our CI it seems not possible to use $H0, 'localhost', $(hostname --fqdn) +# or even "127.0.0.1".... +sleep 2 +host=`netstat -nap | grep $GFAPI_PID | grep 24007 | awk '{print $4}' | cut -d: -f1` +TEST $CLI_3 volume statedump $V0 client $host:$GFAPI_PID +EXPECT_WITHIN $STATEDUMP_TIMEOUT "Y" path_exists $statedumpdir/glusterdump.$GFAPI_PID* + +kill $GFAPI_PID + +cleanup_statedump +cleanup_tester $(dirname $0)/bug-1169302 +cleanup
\ No newline at end of file diff --git a/tests/bugs/cli/bug-1320388.t b/tests/bugs/cli/bug-1320388.t index f6ea3d6c882..e719fc59033 100755 --- a/tests/bugs/cli/bug-1320388.t +++ b/tests/bugs/cli/bug-1320388.t @@ -19,15 +19,17 @@ SSL_CA=$SSL_BASE/glusterfs.ca cleanup; rm -f $SSL_BASE/glusterfs.* -touch /var/lib/glusterd/secure-access +touch "$GLUSTERD_WORKDIR"/secure-access -TEST openssl genrsa -out $SSL_KEY 1024 +TEST openssl genrsa -out $SSL_KEY 2048 TEST openssl req -new -x509 -key $SSL_KEY -subj /CN=Anyone -out $SSL_CERT ln $SSL_CERT $SSL_CA TEST glusterd TEST pidof glusterd TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} +TEST $CLI volume set $V0 disperse.eager-lock off +TEST $CLI volume set $V0 disperse.other-eager-lock off TEST $CLI volume start $V0 TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 EXPECT_WITHIN $CHILD_UP_TIMEOUT "^6$" ec_child_up_count $V0 0 diff --git a/tests/bugs/cli/bug-1353156-get-state-cli-validations.t b/tests/bugs/cli/bug-1353156-get-state-cli-validations.t new file mode 100644 index 00000000000..a4556c9c997 --- /dev/null +++ b/tests/bugs/cli/bug-1353156-get-state-cli-validations.t @@ -0,0 +1,147 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../traps.rc + +cleanup; + +ODIR="/var/tmp/gdstates/" +NOEXDIR="/var/tmp/gdstatesfoo/" + +function get_daemon_not_supported_part { + echo $1 +} + +function get_usage_part { + echo $7 +} + +function get_directory_doesnt_exist_part { + echo $1 +} + +function get_parsing_arguments_part { + echo $1 +} + +function positive_test { + local text=$("$@") + echo $text > /dev/stderr + (echo -n $text | grep -qs ' state dumped to ') || return 1 + local opath=$(echo -n $text | awk '{print $5}') + [ -r $opath ] || return 1 + rm -f $opath +} + +TEST glusterd +TEST pidof glusterd +TEST mkdir -p $ODIR + +push_trapfunc rm -rf $ODIR + +TEST $CLI volume create $V0 disperse $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 +TEST $CLI volume start $V0 + +TEST setup_lvm 1 +TEST $CLI volume create $V1 $H0:$L1; +TEST $CLI volume start $V1 + +TEST $CLI snapshot create ${V1}_snap $V1 + +TEST positive_test $CLI get-state + +TEST positive_test $CLI get-state glusterd + +TEST ! $CLI get-state glusterfsd; +ERRSTR=$($CLI get-state glusterfsd 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST positive_test $CLI get-state file gdstate + +TEST positive_test $CLI get-state glusterd file gdstate + +TEST ! $CLI get-state glusterfsd file gdstate; +ERRSTR=$($CLI get-state glusterfsd file gdstate 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST positive_test $CLI get-state odir $ODIR + +TEST positive_test $CLI get-state glusterd odir $ODIR + +TEST positive_test $CLI get-state odir $ODIR file gdstate + +TEST positive_test $CLI get-state glusterd odir $ODIR file gdstate + +TEST positive_test $CLI get-state detail + +TEST positive_test $CLI get-state glusterd detail + +TEST positive_test $CLI get-state odir $ODIR detail + +TEST positive_test $CLI get-state glusterd odir $ODIR detail + +TEST positive_test $CLI get-state glusterd odir $ODIR file gdstate detail + +TEST positive_test $CLI get-state volumeoptions + +TEST positive_test $CLI get-state glusterd volumeoptions + +TEST positive_test $CLI get-state odir $ODIR volumeoptions + +TEST positive_test $CLI get-state glusterd odir $ODIR volumeoptions + +TEST positive_test $CLI get-state glusterd odir $ODIR file gdstate volumeoptions + +TEST ! $CLI get-state glusterfsd odir $ODIR; +ERRSTR=$($CLI get-state glusterfsd odir $ODIR 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST ! $CLI get-state glusterfsd odir $ODIR file gdstate; +ERRSTR=$($CLI get-state glusterfsd odir $ODIR file gdstate 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST ! $CLI get-state glusterfsd odir $NOEXDIR file gdstate; +ERRSTR=$($CLI get-state glusterfsd odir $NOEXDIR file gdstate 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST ! $CLI get-state odir $NOEXDIR; +ERRSTR=$($CLI get-state odir $NOEXDIR 2>&1 >/dev/null); +EXPECT 'Failed' get_directory_doesnt_exist_part $ERRSTR; + +TEST ! $CLI get-state odir $NOEXDIR file gdstate; +ERRSTR=$($CLI get-state odir $NOEXDIR 2>&1 >/dev/null); +EXPECT 'Failed' get_directory_doesnt_exist_part $ERRSTR; + +TEST ! $CLI get-state foo bar; +ERRSTR=$($CLI get-state foo bar 2>&1 >/dev/null); +EXPECT 'glusterd' get_daemon_not_supported_part $ERRSTR; +EXPECT 'Usage:' get_usage_part $ERRSTR; + +TEST ! $CLI get-state glusterd foo bar; +ERRSTR=$($CLI get-state glusterd foo bar 2>&1 >/dev/null); +EXPECT 'Problem' get_parsing_arguments_part $ERRSTR; + +TEST ! $CLI get-state glusterd detail file gdstate; +ERRSTR=$($CLI get-state glusterd foo bar 2>&1 >/dev/null); +EXPECT 'Problem' get_parsing_arguments_part $ERRSTR; + +TEST ! $CLI get-state glusterd foo bar detail; +ERRSTR=$($CLI get-state glusterd foo bar 2>&1 >/dev/null); +EXPECT 'Problem' get_parsing_arguments_part $ERRSTR; + +TEST ! $CLI get-state glusterd volumeoptions file gdstate; +ERRSTR=$($CLI get-state glusterd foo bar 2>&1 >/dev/null); +EXPECT 'Problem' get_parsing_arguments_part $ERRSTR; + +TEST ! $CLI get-state glusterd foo bar volumeoptions; +ERRSTR=$($CLI get-state glusterd foo bar 2>&1 >/dev/null); +EXPECT 'Problem' get_parsing_arguments_part $ERRSTR; + +cleanup; diff --git a/tests/bugs/cli/bug-1378842-volume-get-all.t b/tests/bugs/cli/bug-1378842-volume-get-all.t new file mode 100644 index 00000000000..be41f25b000 --- /dev/null +++ b/tests/bugs/cli/bug-1378842-volume-get-all.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume set all server-quorum-ratio 80 + +# Execute volume get without having an explicit option, this should fail +TEST ! $CLI volume get all + +# Execute volume get with an explicit global option +TEST $CLI volume get all server-quorum-ratio +EXPECT '80' volume_get_field all 'cluster.server-quorum-ratio' + +# Execute volume get with 'all' +TEST $CLI volume get all all + +cleanup; + diff --git a/tests/bugs/cli/bug-770655.t b/tests/bugs/cli/bug-770655.t deleted file mode 100755 index 4e0b20d62da..00000000000 --- a/tests/bugs/cli/bug-770655.t +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -cleanup; - -## Start and create a distribute-replicate volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Distributed-Replicate' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST ! $CLI volume set $V0 stripe-block-size 10MB -EXPECT '' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; - -## Start and create a replicate volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 replica 8 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Replicate' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST ! $CLI volume set $V0 stripe-block-size 10MB -EXPECT '' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; - -## Start and create a distribute volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Distribute' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST ! $CLI volume set $V0 stripe-block-size 10MB -EXPECT '' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; - -## Start and create a stripe volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 stripe 8 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Stripe' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST $CLI volume set $V0 stripe-block-size 10MB -EXPECT '10MB' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; - -## Start and create a distributed stripe volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 stripe 4 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Distributed-Stripe' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST $CLI volume set $V0 stripe-block-size 10MB -EXPECT '10MB' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; - -## Start and create a distributed stripe replicate volume -TEST glusterd; -TEST pidof glusterd; -TEST $CLI volume create $V0 stripe 2 replica 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; - -## Verify volume is created -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT 'Distributed-Striped-Replicate' volinfo_field $V0 'Type'; - -## Start volume and verify -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Setting stripe-block-size as 10MB -TEST $CLI volume set $V0 stripe-block-size 10MB -EXPECT '10MB' volinfo_field $V0 'cluster.stripe-block-size'; - -## Finish up -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; diff --git a/tests/bugs/cli/bug-822830.t b/tests/bugs/cli/bug-822830.t index b66aa4f8981..a9904854110 100755 --- a/tests/bugs/cli/bug-822830.t +++ b/tests/bugs/cli/bug-822830.t @@ -8,7 +8,7 @@ cleanup; ## Start and create a volume TEST glusterd; TEST pidof glusterd; -TEST $CLI volume create $V0 replica 2 stripe 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3,4,5,6}; ## Verify volume is is created EXPECT "$V0" volinfo_field $V0 'Volume Name'; diff --git a/tests/bugs/cli/bug-961307.t b/tests/bugs/cli/bug-961307.t index 68fc7bb6a15..602a6e34bce 100644 --- a/tests/bugs/cli/bug-961307.t +++ b/tests/bugs/cli/bug-961307.t @@ -13,7 +13,7 @@ TEST pidof glusterd TEST $CLI volume create $V0 replica $REPLICA $H0:$B0/${V0}-00 $H0:$B0/${V0}-01 $H0:$B0/${V0}-10 $H0:$B0/${V0}-11 TEST $CLI volume start $V0 -var1=$(gluster volume remove-brick $H0:$B0/${V0}-00 $H0:$B0/${V0}-01 start 2>&1) +var1=$($CLI volume remove-brick $H0:$B0/${V0}-00 $H0:$B0/${V0}-01 start 2>&1) var2="volume remove-brick start: failed: Volume $H0:$B0/${V0}-00 does not exist" EXPECT "$var2" echo "$var1" diff --git a/tests/bugs/cli/bug-983317-volume-get.t b/tests/bugs/cli/bug-983317-volume-get.t index 8f09d588565..c793bbc9f0c 100644 --- a/tests/bugs/cli/bug-983317-volume-get.t +++ b/tests/bugs/cli/bug-983317-volume-get.t @@ -7,7 +7,8 @@ cleanup; TEST glusterd TEST pidof glusterd -TEST $CLI volume create $V0 $H0:$B0/$V0 +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +EXPECT 'Created' volinfo_field $V0 'Status'; # Set a volume option TEST $CLI volume set $V0 open-behind on @@ -32,3 +33,13 @@ EXPECT '80' volume_get_field $V0 'server-quorum-ratio' # Check user.* options can also be retrived using volume get EXPECT 'dummy' volume_get_field $V0 'user.metadata' + +TEST $CLI volume set all brick-multiplex enable +EXPECT 'enable' volume_get_field $V0 'brick-multiplex' + +TEST $CLI volume set all brick-multiplex disable +EXPECT 'disable' volume_get_field $V0 'brick-multiplex' + +#setting an cluster level option for single volume should fail +TEST ! $CLI volume set $V0 brick-multiplex enable + |
