Skip to content

Commit c5de8a7

Browse files
authored
chore(test): unskip previously skipped tests (#9537)
1 parent ed39971 commit c5de8a7

4 files changed

Lines changed: 7 additions & 18 deletions

File tree

dgraph/cmd/dgraphimport/import_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ func TestEmptyBulkOutDir(t *testing.T) {
7575
}
7676

7777
func TestDrainModeAfterStartSnapshotStream(t *testing.T) {
78-
t.Skip("Skipping... sometimes the query for schema succeeds even when the server is in draining mode")
79-
8078
tests := []struct {
8179
name string
8280
numAlphas int
@@ -123,8 +121,6 @@ func TestDrainModeAfterStartSnapshotStream(t *testing.T) {
123121
}
124122

125123
func TestImportApis(t *testing.T) {
126-
t.Skip("Skipping import tests due to persistent flakiness with container networking and Raft leadership issues")
127-
128124
tests := []testcase{
129125
{
130126
name: "SingleGroupShutTwoAlphasPerGroup",
@@ -391,12 +387,12 @@ func verifyImportResults(t *testing.T, gc *dgraphapi.GrpcClient, downAlphas int)
391387
}
392388

393389
retryDelay := time.Second
394-
hasAllPredicates := true
395390

396391
// Get expected predicates first
397392
var expectedSchemaObj map[string]interface{}
398393
require.NoError(t, json.Unmarshal([]byte(expectedSchema), &expectedSchemaObj))
399394
expectedPredicates := getPredicateMap(expectedSchemaObj)
395+
var hasAllPredicates bool
400396

401397
for i := 0; i < maxRetries; i++ {
402398
// Checking client connection again here because an import operation may be in progress on the rejoined alpha
@@ -412,7 +408,7 @@ func verifyImportResults(t *testing.T, gc *dgraphapi.GrpcClient, downAlphas int)
412408
// Get actual predicates
413409
actualPredicates := getPredicateMap(actualSchema)
414410

415-
// Check if all expected predicates are present
411+
hasAllPredicates = true
416412
for predName := range expectedPredicates {
417413
if _, exists := actualPredicates[predName]; !exists {
418414
hasAllPredicates = false

dgraphtest/load.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ func downloadFile(fname, url string) error {
580580
cmd := exec.Command("wget", "-O", fname, url)
581581
cmd.Dir = datasetFilesPath
582582

583-
if out, err := cmd.CombinedOutput(); err != nil {
584-
return fmt.Errorf("error downloading file %s: %s", fname, string(out))
583+
if _, err := cmd.CombinedOutput(); err != nil {
584+
return fmt.Errorf("error downloading file %s: %w", fname, err)
585585
}
586586
return nil
587587
}

dgraphtest/local_cluster.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,7 @@ func (c *LocalCluster) Client() (*dgraphapi.GrpcClient, func(), error) {
930930
var conns []*grpc.ClientConn
931931
for _, aa := range c.alphas {
932932
if !aa.isRunning {
933-
// QUESTIONS(shivaji): Should this be 'continue' instead of a break from the loop
934-
break
933+
continue
935934
}
936935
url, err := aa.alphaURL(c)
937936
if err != nil {

worker/import.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func InStream(stream api.Dgraph_StreamExtSnapshotServer) error {
298298
return fmt.Errorf("failed to establish stream with leader: %v", err)
299299
}
300300
glog.Infof("[import] [forward %d -> %d] start", groups().Node.gid, groupId)
301-
glog.Infof("[import] [forward %d -> %d] start", groups().Node.MyAddr, groups().Leader(groupId).Addr)
301+
glog.Infof("[import] [forward %v -> %d] start", groups().Node.MyAddr, groups().Leader(groupId).Addr)
302302

303303
glog.Infof("[import] sending forward true to leader of group [%v]", groupId)
304304
forwardReq := &api.StreamExtSnapshotRequest{Forward: true}
@@ -313,12 +313,6 @@ func InStream(stream api.Dgraph_StreamExtSnapshotServer) error {
313313
func pipeTwoStream(in api.Dgraph_StreamExtSnapshotServer, out pb.Worker_StreamExtSnapshotClient, groupId uint32) error {
314314
currentGroup := groups().Node.gid
315315
ctx := in.Context()
316-
if err := out.Send(&api.StreamExtSnapshotRequest{GroupId: groupId}); err != nil {
317-
return fmt.Errorf("send groupId downstream(%d): %w", groupId, err)
318-
}
319-
if _, err := out.Recv(); err != nil {
320-
return fmt.Errorf("ack groupId downstream(%d): %w", groupId, err)
321-
}
322316

323317
for {
324318
if err := ctx.Err(); err != nil {
@@ -487,7 +481,7 @@ func streamInGroup(stream api.Dgraph_StreamExtSnapshotServer, forward bool) erro
487481
if forward {
488482
// We are not going to return any error from here because we care about the majority of nodes.
489483
// If the majority of nodes are able to receive the data, the remaining ones can catch up later.
490-
glog.Infof("[import] Streaming external snapshot to [%v] from [%v] forward [%v]", member.Addr, node.MyAddr)
484+
glog.Infof("[import] Streaming external snapshot to [%v] from [%v]", member.Addr, node.MyAddr)
491485
eg.Go(func() error {
492486
glog.Infof(`[import:forward] streaming external snapshot to [%v] from [%v]`, member.Addr, node.MyAddr)
493487
if member.AmDead {

0 commit comments

Comments
 (0)