Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.

Commit a7fe8e3

Browse files
committed
Merge branch 'master' of https://github.com/gluster/glusterd2 into rebalance
2 parents 7a35c21 + a45abee commit a7fe8e3

File tree

16 files changed

+137
-33
lines changed

16 files changed

+137
-33
lines changed

e2e/bitrot_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestBitrot(t *testing.T) {
1818
r.Nil(err)
1919
defer teardownCluster(gds)
2020

21-
client = initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
21+
client = initRestclient(gds[0])
2222

2323
// test Bitrot on dist-rep volume
2424
t.Run("Replica-volume", testBitrotOnReplicaVolume)

e2e/georep_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestGeorepCreateDelete(t *testing.T) {
2828
brickPaths = append(brickPaths, brickPath)
2929
}
3030

31-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
31+
client := initRestclient(gds[0])
3232

3333
volname := formatVolName(t.Name())
3434
reqVol := api.VolCreateReq{

e2e/glustershd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestSelfHealInfo(t *testing.T) {
2727
brickPaths[i-1] = brickPath
2828
}
2929

30-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
30+
client := initRestclient(gds[0])
3131
volname := formatVolName(t.Name())
3232
reqVol := api.VolCreateReq{
3333
Name: volname,

e2e/peer_ops_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestAddRemovePeer(t *testing.T) {
2727
defer g3.Stop()
2828
r.True(g3.IsRunning())
2929

30-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
30+
client := initRestclient(gds[0])
3131
peerAddReq := api.PeerAddReq{
3232
Addresses: []string{g2.PeerAddress},
3333
Metadata: map[string]string{

e2e/quota_enable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestQuota(t *testing.T) {
3535
brickPaths = append(brickPaths, brickPath)
3636
}
3737

38-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
38+
client := initRestclient(gds[0])
3939

4040
// create 2x2 dist-rep volume
4141
createReq := api.VolCreateReq{

e2e/restart_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestRestart(t *testing.T) {
2121
r.Nil(err)
2222
defer os.RemoveAll(dir)
2323

24-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
24+
client := initRestclient(gds[0])
2525

2626
createReq := api.VolCreateReq{
2727
Name: formatVolName(t.Name()),
@@ -52,7 +52,7 @@ func TestRestart(t *testing.T) {
5252
}
5353

5454
func getVols(gd *gdProcess, r *require.Assertions) api.VolumeListResp {
55-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
55+
client := initRestclient(gds[0])
5656
volname := ""
5757
vols, err := client.Volumes(volname)
5858
r.Nil(err)

e2e/smartvol_ops_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func TestSmartVolume(t *testing.T) {
236236
r.Nil(err)
237237
defer teardownCluster(gds)
238238

239-
client = initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
239+
client = initRestclient(gds[0])
240240

241241
devicesDir, err := ioutil.TempDir(baseLocalStateDir, t.Name())
242242
r.Nil(err)

e2e/utils_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func setupCluster(configFiles ...string) ([]*gdProcess, error) {
192192
}
193193

194194
// restclient instance that will be used for peer operations
195-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
195+
client := initRestclient(gds[0])
196196

197197
// first gd2 instance spawned shall add other glusterd2 instances as its peers
198198
for i, gd := range gds {
@@ -238,9 +238,9 @@ func teardownCluster(gds []*gdProcess) error {
238238
return nil
239239
}
240240

241-
func initRestclient(clientAddress, authPath string) *restclient.Client {
242-
secret := getAuth(authPath)
243-
return restclient.New("http://"+clientAddress, "glustercli", secret, "", false)
241+
func initRestclient(gdp *gdProcess) *restclient.Client {
242+
secret := getAuth(gdp.LocalStateDir)
243+
return restclient.New("http://"+gdp.ClientAddress, "glustercli", secret, "", false)
244244
}
245245

246246
func prepareLoopDevice(devname, loopnum, size string) error {

e2e/volume_ops_test.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestVolume(t *testing.T) {
4040
r.Nil(err)
4141
defer teardownCluster(gds)
4242

43-
client = initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
43+
client = initRestclient(gds[0])
4444

4545
t.Run("CreateWithoutName", testVolumeCreateWithoutName)
4646

@@ -418,7 +418,7 @@ func TestVolumeOptions(t *testing.T) {
418418
brickPath, err := ioutil.TempDir(brickDir, "brick")
419419
r.Nil(err)
420420

421-
client := initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
421+
client := initRestclient(gds[0])
422422

423423
volname := "testvol"
424424
createReq := api.VolCreateReq{
@@ -451,6 +451,11 @@ func TestVolumeOptions(t *testing.T) {
451451
_, err = client.VolumeGet(volname, validKey)
452452
r.Nil(err)
453453

454+
var resetOptionReq api.VolOptionResetReq
455+
resetOptionReq.Options = append(resetOptionReq.Options, validKey)
456+
resetOptionReq.Force = true
457+
r.Nil(client.VolumeReset(volname, resetOptionReq))
458+
454459
err = client.VolumeDelete(volname)
455460
r.Nil(err)
456461
}
@@ -485,9 +490,26 @@ func TestVolumeOptions(t *testing.T) {
485490
settableKey := "afr.use-compound-fops"
486491
optionReq.Options = map[string]string{settableKey: "on"}
487492
r.Nil(client.VolumeSet(volname, optionReq))
493+
494+
var resetOptionReq api.VolOptionResetReq
495+
resetOptionReq.Options = []string{"afr.use-compound-fops"}
496+
resetOptionReq.Force = true
497+
r.Nil(client.VolumeReset(volname, resetOptionReq))
498+
499+
validOpKeys = []string{"io-stats.count-fop-hits", "io-stats.latency-measurement"}
500+
for _, validKey := range validOpKeys {
501+
optionReq.Options = map[string]string{validKey: "on"}
502+
r.Nil(client.VolumeSet(volname, optionReq))
503+
}
504+
505+
resetOptionReq.Force = true
506+
resetOptionReq.All = true
507+
r.Nil(client.VolumeReset(volname, resetOptionReq))
508+
488509
notSettableKey := "afr.consistent-io"
489510
optionReq.Options = map[string]string{notSettableKey: "on"}
490511
r.NotNil(client.VolumeSet(volname, optionReq))
512+
491513
r.Nil(client.VolumeDelete(volname))
492514

493515
// group option test cases
@@ -501,7 +523,6 @@ func TestVolumeOptions(t *testing.T) {
501523
err = client.VolumeDelete(volname)
502524
r.Nil(err)
503525
}
504-
505526
for _, validKey := range groupOpKeys {
506527
createReq.Options = map[string]string{validKey: "off"}
507528

e2e/webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestWebhook(t *testing.T) {
2424
r.Nil(err)
2525
defer teardownCluster(gds)
2626

27-
client = initRestclient(gds[0].ClientAddress, gds[0].LocalStateDir)
27+
client = initRestclient(gds[0])
2828

2929
t.Run("Register-webhook", testAddWebhook)
3030
t.Run("List-webhook", testGetWebhook)

0 commit comments

Comments
 (0)