diff options
Diffstat (limited to 'tests/bugs/cli')
| -rw-r--r-- | tests/bugs/cli/bug-1004218.t | 26 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1022905.t | 37 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1030580.t | 53 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1047378.t | 12 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1047416.t | 71 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1077682.t | 24 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-1087487.t | 23 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-1113476.t | 45 | ||||
| -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 | 44 | ||||
| -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 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-764638.t | 13 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-822830.t | 64 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-867252.t | 41 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-921215.t | 13 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-949298.t | 12 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-961307.t | 20 | ||||
| -rwxr-xr-x | tests/bugs/cli/bug-969193.t | 13 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-977246.t | 21 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-982174.t | 36 | ||||
| -rw-r--r-- | tests/bugs/cli/bug-983317-volume-get.t | 45 |
23 files changed, 917 insertions, 0 deletions
diff --git a/tests/bugs/cli/bug-1004218.t b/tests/bugs/cli/bug-1004218.t new file mode 100644 index 00000000000..ab8307d6405 --- /dev/null +++ b/tests/bugs/cli/bug-1004218.t @@ -0,0 +1,26 @@ +#!/bin/bash + +# Test if only a single xml document is generated by 'status all' +# when a volume is not started + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd + +TEST $CLI volume create ${V0}1 $H0:$B0/${V0}1{1,2} +TEST $CLI volume create ${V0}2 $H0:$B0/${V0}2{1,2} + +TEST $CLI volume start ${V0}1 + +function test_status_all () +{ + $CLI volume status all --xml | xmllint -format - +} + +TEST test_status_all + +TEST $CLI volume stop ${V0}1 + +cleanup diff --git a/tests/bugs/cli/bug-1022905.t b/tests/bugs/cli/bug-1022905.t new file mode 100644 index 00000000000..ee629e970d9 --- /dev/null +++ b/tests/bugs/cli/bug-1022905.t @@ -0,0 +1,37 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Create a volume +TEST glusterd; +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1}; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Volume start +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +## Enable a protected and a resettable/unprotected option +TEST $CLI volume quota $V0 enable +TEST $CLI volume set $V0 diagnostics.client-log-level DEBUG + +## Reset cmd resets only unprotected option(s), succeeds. +TEST $CLI volume reset $V0; + +## Set an unprotected option +TEST $CLI volume set $V0 diagnostics.client-log-level DEBUG + +## Now 1 protected and 1 unprotected options are set +## Reset force should succeed +TEST $CLI volume reset $V0 force; + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; diff --git a/tests/bugs/cli/bug-1030580.t b/tests/bugs/cli/bug-1030580.t new file mode 100644 index 00000000000..ac8b1d8f6db --- /dev/null +++ b/tests/bugs/cli/bug-1030580.t @@ -0,0 +1,53 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function write_to_file { + dd of=$M0/1 if=/dev/zero bs=1024k count=128 oflag=append 2>&1 >/dev/null +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +# Increasing the json stats dump time interval, so that it doesn't mess with the test. +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 3600 +TEST $CLI volume start $V0 +TEST $CLI volume profile $V0 start +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +# Clear the profile info uptill now. +TEST $CLI volume profile $V0 info clear + +# Verify 'volume profile info' prints both cumulative and incremental stats +write_to_file & +wait +output=$($CLI volume profile $V0 info) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 0 ' + +# Verify 'volume profile info incremental' prints incremental stats only +write_to_file & +wait +output=$($CLI volume profile $V0 info incremental) +EXPECT 0 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 1 ' + +# Verify 'volume profile info cumulative' prints cumulative stats only +write_to_file & +wait +output=$($CLI volume profile $V0 info cumulative) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 0 incremental_stat_count "$output" '.*' + +# Verify the 'volume profile info cumulative' command above didn't alter +# the interval id +write_to_file & +wait +output=$($CLI volume profile $V0 info incremental) +EXPECT 0 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 2 ' + +cleanup; diff --git a/tests/bugs/cli/bug-1047378.t b/tests/bugs/cli/bug-1047378.t new file mode 100644 index 00000000000..33ee6be3d8b --- /dev/null +++ b/tests/bugs/cli/bug-1047378.t @@ -0,0 +1,12 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST "echo volume list | $CLI --xml | xmllint --format -" + +cleanup diff --git a/tests/bugs/cli/bug-1047416.t b/tests/bugs/cli/bug-1047416.t new file mode 100644 index 00000000000..864301034c9 --- /dev/null +++ b/tests/bugs/cli/bug-1047416.t @@ -0,0 +1,71 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function write_to_file { + dd of=$M0/1 if=/dev/zero bs=1024k count=128 oflag=append 2>&1 >/dev/null +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +# Increasing the json stats dump time interval, so that it doesn't mess with the test. +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 3600 +TEST $CLI volume start $V0 +TEST $CLI volume profile $V0 start +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +# Clear the profile info uptill now. +TEST $CLI volume profile $V0 info clear + +# Verify 'volume profile info' prints both cumulative and incremental stats +write_to_file & +wait +output=$($CLI volume profile $V0 info) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 0 ' + +# Verify 'volume profile info peek' prints both cumulative and incremental stats +# without clearing incremental stats +write_to_file & +wait +output=$($CLI volume profile $V0 info peek) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 1 ' + +write_to_file & +wait +output=$($CLI volume profile $V0 info peek) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 1 ' + +# Verify 'volume profile info incremental peek' prints incremental stats only +# without clearing incremental stats +write_to_file & +wait +output=$($CLI volume profile $V0 info incremental peek) +EXPECT 0 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 1 ' + +write_to_file & +wait +output=$($CLI volume profile $V0 info incremental peek) +EXPECT 0 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 1 ' + +# Verify 'volume profile info clear' clears both incremental and cumulative stats +write_to_file & +wait +output=$($CLI volume profile $V0 info clear) +EXPECT 2 cleared_stat_count "$output" + +output=$($CLI volume profile $V0 info) +EXPECT 2 cumulative_stat_count "$output" +EXPECT 2 incremental_stat_count "$output" ' 0 ' +EXPECT 4 data_read_count "$output" ' 0 ' +EXPECT 4 data_written_count "$output" ' 0 ' + +cleanup; diff --git a/tests/bugs/cli/bug-1077682.t b/tests/bugs/cli/bug-1077682.t new file mode 100644 index 00000000000..eab5d86d04b --- /dev/null +++ b/tests/bugs/cli/bug-1077682.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3,4} +TEST $CLI volume start $V0 +TEST ! $CLI volume remove-brick $V0 $H0:$B0/${V0}1 +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3 start + +EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0" \ +"$H0:$B0/${V0}3" + +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3 commit +TEST killall glusterd +TEST glusterd + +cleanup diff --git a/tests/bugs/cli/bug-1087487.t b/tests/bugs/cli/bug-1087487.t new file mode 100755 index 00000000000..0659ffab684 --- /dev/null +++ b/tests/bugs/cli/bug-1087487.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function rebalance_start { + $CLI volume rebalance $1 start | head -1; +} + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 + +TEST $CLI volume start $V0 + +EXPECT "volume rebalance: $V0: success: Rebalance on $V0 has \ +been started successfully. Use rebalance status command to \ +check status of the rebalance process." rebalance_start $V0 + +cleanup; diff --git a/tests/bugs/cli/bug-1113476.t b/tests/bugs/cli/bug-1113476.t new file mode 100644 index 00000000000..fc7dbca537d --- /dev/null +++ b/tests/bugs/cli/bug-1113476.t @@ -0,0 +1,45 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc + +function volinfo_validate () +{ + local var=$1 + $CLI volume info $V0 | grep "^$var" | sed 's/.*: //' +} + +cleanup; + +TEST verify_lvm_version +TEST glusterd +TEST pidof glusterd +TEST setup_lvm 1 + +TEST $CLI volume create $V0 $H0:$L1 +TEST $CLI volume start $V0 + +EXPECT '' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config snap-max-hard-limit 100 +TEST $CLI snapshot config $V0 snap-max-hard-limit 50 +EXPECT '' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config snap-max-soft-limit 50 +EXPECT '' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config auto-delete enable +EXPECT '' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT 'enable' volinfo_validate 'auto-delete' + +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 new file mode 100755 index 00000000000..e719fc59033 --- /dev/null +++ b/tests/bugs/cli/bug-1320388.t @@ -0,0 +1,44 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +# This test enables management ssl and then test the +# heal info command. + +for d in /etc/ssl /etc/openssl /usr/local/etc/openssl ; do + if test -d $d ; then + SSL_BASE=$d + break + fi +done + +SSL_KEY=$SSL_BASE/glusterfs.key +SSL_CERT=$SSL_BASE/glusterfs.pem +SSL_CA=$SSL_BASE/glusterfs.ca + +cleanup; +rm -f $SSL_BASE/glusterfs.* +touch "$GLUSTERD_WORKDIR"/secure-access + +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 +touch $M0/a +TEST kill_brick $V0 $H0 $B0/${V0}5 +echo abc > $M0/a +EXPECT_WITHIN $HEAL_TIMEOUT "^5$" get_pending_heal_count $V0 #One for each active brick +$CLI volume start $V0 force +EXPECT_WITHIN $CHILD_UP_TIMEOUT "^6$" ec_child_up_count $V0 0 +TEST gluster volume heal $V0 info +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 #One for each active brick +cleanup; 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-764638.t b/tests/bugs/cli/bug-764638.t new file mode 100644 index 00000000000..ffc613409d6 --- /dev/null +++ b/tests/bugs/cli/bug-764638.t @@ -0,0 +1,13 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI pool list; +TEST $CLI pool list --xml; + +cleanup; diff --git a/tests/bugs/cli/bug-822830.t b/tests/bugs/cli/bug-822830.t new file mode 100755 index 00000000000..a9904854110 --- /dev/null +++ b/tests/bugs/cli/bug-822830.t @@ -0,0 +1,64 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +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'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +## Setting nfs.rpc-auth-reject as 192.{}.1.2 +TEST ! $CLI volume set $V0 nfs.rpc-auth-reject 192.{}.1.2 +EXPECT '' volinfo_field $V0 'nfs.rpc-auth-reject'; + +# Setting nfs.rpc-auth-allow as a.a. +TEST ! $CLI volume set $V0 nfs.rpc-auth-allow a.a. +EXPECT '' volinfo_field $V0 'nfs.rpc-auth-allow'; + +## Setting nfs.rpc-auth-reject as 192.*..* +TEST $CLI volume set $V0 nfs.rpc-auth-reject 192.*..* +EXPECT '192.*..*' volinfo_field $V0 'nfs.rpc-auth-reject'; + +# Setting nfs.rpc-auth-allow as a.a +TEST $CLI volume set $V0 nfs.rpc-auth-allow a.a +EXPECT 'a.a' volinfo_field $V0 'nfs.rpc-auth-allow'; + +# Setting nfs.rpc-auth-allow as *.redhat.com +TEST $CLI volume set $V0 nfs.rpc-auth-allow *.redhat.com +EXPECT '\*.redhat.com' volinfo_field $V0 'nfs.rpc-auth-allow'; + +# Setting nfs.rpc-auth-allow as 192.168.10.[1-5] +TEST $CLI volume set $V0 nfs.rpc-auth-allow 192.168.10.[1-5] +EXPECT '192.168.10.\[1-5]' volinfo_field $V0 'nfs.rpc-auth-allow'; + +# Setting nfs.rpc-auth-allow as 192.168.70.? +TEST $CLI volume set $V0 nfs.rpc-auth-allow 192.168.70.? +EXPECT '192.168.70.?' volinfo_field $V0 'nfs.rpc-auth-allow'; + +# Setting nfs.rpc-auth-reject as 192.168.10.5/16 +TEST $CLI volume set $V0 nfs.rpc-auth-reject 192.168.10.5/16 +EXPECT '192.168.10.5/16' volinfo_field $V0 'nfs.rpc-auth-reject'; + +## Setting nfs.rpc-auth-reject as 192.*.* +TEST $CLI volume set $V0 nfs.rpc-auth-reject 192.*.* +EXPECT '192.*.*' volinfo_field $V0 'nfs.rpc-auth-reject'; + +## 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-867252.t b/tests/bugs/cli/bug-867252.t new file mode 100644 index 00000000000..ccc33d82a0f --- /dev/null +++ b/tests/bugs/cli/bug-867252.t @@ -0,0 +1,41 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/${V0}1; + + +function volinfo_field() +{ + local vol=$1; + local field=$2; + + $CLI volume info $vol | grep "^$field: " | sed 's/.*: //'; +} + + +function brick_count() +{ + local vol=$1; + + $CLI volume info $vol | egrep "^Brick[0-9]+: " | wc -l; +} + + +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '1' brick_count $V0 + +TEST $CLI volume add-brick $V0 $H0:$B0/${V0}2; +EXPECT '2' brick_count $V0 + +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force; +EXPECT '1' brick_count $V0 + +cleanup; diff --git a/tests/bugs/cli/bug-921215.t b/tests/bugs/cli/bug-921215.t new file mode 100755 index 00000000000..02532562cff --- /dev/null +++ b/tests/bugs/cli/bug-921215.t @@ -0,0 +1,13 @@ +#!/bin/bash + +# This is test case for bug no 921215 "Can not create volume with a . in the name" + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST ! $CLI volume create $V0.temp replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 + +cleanup; diff --git a/tests/bugs/cli/bug-949298.t b/tests/bugs/cli/bug-949298.t new file mode 100644 index 00000000000..e0692f0c157 --- /dev/null +++ b/tests/bugs/cli/bug-949298.t @@ -0,0 +1,12 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TEST glusterd +TEST pidof glusterd + +TEST $CLI --xml volume info $V0 + +cleanup; diff --git a/tests/bugs/cli/bug-961307.t b/tests/bugs/cli/bug-961307.t new file mode 100644 index 00000000000..602a6e34bce --- /dev/null +++ b/tests/bugs/cli/bug-961307.t @@ -0,0 +1,20 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +REPLICA=2 + +TEST glusterd +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=$($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" +cleanup; diff --git a/tests/bugs/cli/bug-969193.t b/tests/bugs/cli/bug-969193.t new file mode 100755 index 00000000000..dd6d7cdf100 --- /dev/null +++ b/tests/bugs/cli/bug-969193.t @@ -0,0 +1,13 @@ +#!/bin/bash + +# Test that "system getspec" works without op_version problems. + +. $(dirname $0)/../../include.rc +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info +TEST $CLI volume create $V0 $H0:$B0/brick1 +TEST $CLI system getspec $V0 +cleanup; diff --git a/tests/bugs/cli/bug-977246.t b/tests/bugs/cli/bug-977246.t new file mode 100644 index 00000000000..bb8d6328e8b --- /dev/null +++ b/tests/bugs/cli/bug-977246.t @@ -0,0 +1,21 @@ +#! /bin/bash + +# This test checks if address validation, correctly catches hostnames +# with consective dots, such as 'example..org', as invalid + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/${V0}1 +TEST $CLI volume info $V0 +TEST $CLI volume start $V0 + +TEST ! $CLI volume set $V0 auth.allow example..org + +TEST $CLI volume stop $V0 + +cleanup; diff --git a/tests/bugs/cli/bug-982174.t b/tests/bugs/cli/bug-982174.t new file mode 100644 index 00000000000..067e5b97c17 --- /dev/null +++ b/tests/bugs/cli/bug-982174.t @@ -0,0 +1,36 @@ +#!/bin/bash +# Test to check +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#Check if incorrect log-level keywords does not crash the CLI +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2 +TEST $CLI volume start $V0 + +function set_log_level_status { + local level=$1 + $CLI volume set $V0 diagnostics.client-log-level $level 2>&1 |grep -oE 'success|failed' +} + + +LOG_LEVEL="trace" +EXPECT "failed" set_log_level_status $LOG_LEVEL + + +LOG_LEVEL="error-gen" +EXPECT "failed" set_log_level_status $LOG_LEVEL + + +LOG_LEVEL="TRACE" +EXPECT "success" set_log_level_status $LOG_LEVEL + +EXPECT "$LOG_LEVEL" echo `$CLI volume info | grep diagnostics | awk '{print $2}'` + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; diff --git a/tests/bugs/cli/bug-983317-volume-get.t b/tests/bugs/cli/bug-983317-volume-get.t new file mode 100644 index 00000000000..c793bbc9f0c --- /dev/null +++ b/tests/bugs/cli/bug-983317-volume-get.t @@ -0,0 +1,45 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TEST glusterd +TEST pidof glusterd + +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 +TEST $CLI volume start $V0 + +TEST $CLI volume set all server-quorum-ratio 80 + +TEST $CLI volume set $V0 user.metadata 'dummy' + +# Execute volume get without having an explicit option, this should fail +TEST ! $CLI volume get $V0 + +# Execute volume get with an explicit option +TEST $CLI volume get $V0 open-behind +EXPECT 'on' volume_get_field $V0 'open-behind' + +# Execute volume get with 'all" +TEST $CLI volume get $V0 all + +# Check if volume get can display correct global options values as well +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 + |
