Skip to content

Commit fa5701a

Browse files
fix tests
1 parent c245e02 commit fa5701a

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

dgraph/cmd/dgraphimport/import_test.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"strconv"
1515
"strings"
1616
"testing"
17+
"time"
1718

1819
"github.com/hypermodeinc/dgraph/v25/dgraphapi"
1920
"github.com/hypermodeinc/dgraph/v25/dgraphtest"
@@ -102,6 +103,7 @@ func TestImportApis(t *testing.T) {
102103
negativeTestCase bool // True if this is an expected failure case
103104
description string
104105
err string
106+
sleep bool
105107
}{
106108
{
107109
name: "SingleGroupShutTwoAlphasPerGroup",
@@ -152,6 +154,7 @@ func TestImportApis(t *testing.T) {
152154
negativeTestCase: false,
153155
description: "Single group with multiple alphas, shutdown 1 alpha",
154156
err: "",
157+
sleep: true,
155158
},
156159
{
157160
name: "TwoGroupShutOneAlphaPerGroup",
@@ -162,6 +165,7 @@ func TestImportApis(t *testing.T) {
162165
negativeTestCase: false,
163166
description: "Multiple groups with multiple alphas, shutdown 2 alphas per group",
164167
err: "",
168+
sleep: true,
165169
},
166170
{
167171
name: "ThreeGroupShutOneAlphaPerGroup",
@@ -172,6 +176,7 @@ func TestImportApis(t *testing.T) {
172176
negativeTestCase: false,
173177
description: "Three groups with 3 alphas each, shutdown 1 alpha per group",
174178
err: "",
179+
sleep: true,
175180
},
176181
{
177182
name: "SingleGroupAllAlphasOnline",
@@ -212,12 +217,14 @@ func TestImportApis(t *testing.T) {
212217
} else {
213218
t.Logf("Running test case: %s", tt.description)
214219
}
215-
runImportTest(t, tt.bulkAlphas, tt.targetAlphas, tt.replicasFactor, tt.downAlphas, tt.negativeTestCase, tt.err)
220+
runImportTest(t, tt.bulkAlphas, tt.targetAlphas, tt.replicasFactor, tt.downAlphas, tt.negativeTestCase,
221+
tt.err, tt.sleep)
216222
})
217223
}
218224
}
219225

220-
func runImportTest(t *testing.T, bulkAlphas, targetAlphas, replicasFactor, numDownAlphas int, negative bool, errStr string) {
226+
func runImportTest(t *testing.T, bulkAlphas, targetAlphas, replicasFactor, numDownAlphas int, negative bool,
227+
errStr string, sleep bool) {
221228
bulkCluster, baseDir := setupBulkCluster(t, bulkAlphas)
222229
defer func() { bulkCluster.Cleanup(t.Failed()) }()
223230

@@ -296,14 +303,18 @@ func runImportTest(t *testing.T, bulkAlphas, targetAlphas, replicasFactor, numDo
296303
for group, alphas := range alphaGroups {
297304
for i := 0; i < numDownAlphas; i++ {
298305
alphaID := alphas[i]
299-
t.Logf("Shutting down alpha %v from group %v", alphaID, group)
306+
t.Logf("Starting alpha %v from group %v", alphaID, group)
300307
require.NoError(t, targetCluster.StartAlpha(alphaID))
301308
}
302309
}
303310

304311
require.NoError(t, targetCluster.HealthCheck(false))
305312

306-
fmt.Println("Import completed")
313+
if sleep {
314+
time.Sleep(1 * time.Minute)
315+
}
316+
317+
t.Log("Import completed")
307318

308319
for i := 0; i < targetAlphas; i++ {
309320
gc, cleanup, err := targetCluster.AlphaClient(i)

0 commit comments

Comments
 (0)