Skip to content

Commit

Permalink
ci(upgrade): enable upgrade workflow on PR (#9046)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaji-kharse authored Mar 13, 2024
1 parent 3754e87 commit 5a37a32
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-dgraph-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ on:
jobs:
dgraph-load-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04-32gb
runs-on: buildjet-32vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v3
- name: Get Go Version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-dgraph-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ on:
jobs:
dgraph-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04-32gb
runs-on: buildjet-32vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v3
- name: Get Go Version
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci-dgraph-upgrade-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ on:
branches:
- main
- 'release/**'
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
schedule:
- cron: "0 0 * * *" # 1 run per day
jobs:
dgraph-upgrade-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04-32gb
runs-on: buildjet-32vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v3
with:
Expand Down
36 changes: 30 additions & 6 deletions dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,41 @@ 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 {

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)
}
c.Cleanup(false)
if err := c.init(); err != nil {
c.Cleanup(true)
return err
}
}
return c.HealthCheck(false)

return err
}

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

0 comments on commit 5a37a32

Please sign in to comment.