Skip to content

Commit

Permalink
Fix tests failures introduced in #68 (#98)
Browse files Browse the repository at this point in the history
We have added a framework that allows us to add new predicates easily.
This fixes the tests that were failing
  • Loading branch information
mangalaman93 committed Mar 1, 2024
1 parent 3754e87 commit 47a85ae
Show file tree
Hide file tree
Showing 14 changed files with 634 additions and 80 deletions.
32 changes: 25 additions & 7 deletions dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,35 @@ func (c *LocalCluster) Cleanup(verbose bool) {

func (c *LocalCluster) Start() error {
log.Printf("[INFO] starting cluster with prefix [%v]", c.conf.prefix)
for i := 0; i < c.conf.numZeros; i++ {
if err := c.StartZero(i); err != nil {
return err
startAll := func() error {
for i := 0; i < c.conf.numZeros; i++ {
if err := c.StartZero(i); err != nil {
return err
}
}
for i := 0; i < c.conf.numAlphas; i++ {
if err := c.StartAlpha(i); err != nil {
return err
}
}

return c.HealthCheck(false)
}
for i := 0; i < c.conf.numAlphas; i++ {
if err := c.StartAlpha(i); err != nil {
return err

var err error
// sometimes health check doesn't work due to unmapped ports. We dont know why this happens,
// but checking it 4 times before failing the test.
for i := 0; i < 4; i++ {
if err = startAll(); err == nil {
return nil
}
log.Printf("[WARNING] Saw the error :%v, trying again", err)
if err1 := c.Stop(); err1 != nil {
log.Printf("[WARNING] error while stopping :%v", err)
}
}
return c.HealthCheck(false)

return err
}

func (c *LocalCluster) StartZero(id int) error {
Expand Down

0 comments on commit 47a85ae

Please sign in to comment.