summaryrefslogtreecommitdiffstats
path: root/tests/bugs/glusterfs/bug-896431.t
blob: 61f71141713ec29c7aad9fa6da67d25d2af62645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/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 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 cluster.subvols-per-directory as -5
TEST ! $CLI volume set $V0 cluster.subvols-per-directory -5
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';
TEST ! $CLI volume set $V0 subvols-per-directory -5
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';

## Setting cluster.subvols-per-directory as 0
TEST ! $CLI volume set $V0 cluster.subvols-per-directory 0
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';
TEST ! $CLI volume set $V0 subvols-per-directory 0
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';

## Setting cluster.subvols-per-directory as 4 (the total number of bricks)
TEST ! $CLI volume set $V0 cluster.subvols-per-directory 4
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';
TEST ! $CLI volume set $V0 subvols-per-directory 4
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';

## Setting cluster.subvols-per-directory as 2 (the total number of subvolumes)
TEST $CLI volume set $V0 cluster.subvols-per-directory 2
EXPECT '2' volinfo_field $V0 'cluster.subvols-per-directory';

## Setting cluster.subvols-per-directory as 1
TEST $CLI volume set $V0 subvols-per-directory 1
EXPECT '1' volinfo_field $V0 'cluster.subvols-per-directory';

## 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 pure 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 cluster.subvols-per-directory as 8 for a replicate volume
TEST ! $CLI volume set $V0 cluster.subvols-per-directory 8
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';
TEST ! $CLI volume set $V0 subvols-per-directory 8
EXPECT '' volinfo_field $V0 'cluster.subvols-per-directory';

## Setting cluster.subvols-per-directory as 1 for a replicate volume
TEST $CLI volume set $V0 cluster.subvols-per-directory 1
EXPECT '1' volinfo_field $V0 'cluster.subvols-per-directory';
TEST $CLI volume set $V0 subvols-per-directory 1
EXPECT '1' volinfo_field $V0 'cluster.subvols-per-directory';

## Finish up
TEST $CLI volume stop $V0;
EXPECT 'Stopped' volinfo_field $V0 'Status';

TEST $CLI volume delete $V0;
TEST ! $CLI volume info $V0;

cleanup;