Skip to content

Commit

Permalink
Merge 5dc978f into 4294ae6
Browse files Browse the repository at this point in the history
  • Loading branch information
mangalaman93 committed Jun 9, 2023
2 parents 4294ae6 + 5dc978f commit f5802d7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-dgraph-upgrade-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- main
- 'release/**'
schedule:
- cron: "0 */2 * * *" # every 2hrs
- cron: "0 */4 * * *" # every 4hrs
jobs:
dgraph-upgrade-and-integration-tests:
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
# move the binary
cp dgraph/dgraph ~/go/bin/dgraph
# run the tests
go test -v -timeout=60m -failfast -tags=upgrade,integration2 ./...
go test -v -timeout=120m -failfast -tags=upgrade,integration2 ./...
# clean up docker containers after test execution
go clean -testcache
# sleep
Expand Down
23 changes: 16 additions & 7 deletions dgraphtest/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,22 @@ func openDgraphRepo() (*git.Repository, error) {
}

func checkoutGitRepo(repo *git.Repository, hash *plumbing.Hash) error {
worktree, err := repo.Worktree()
if err != nil {
return errors.Wrap(err, "error while getting git repo work tree")
}
if err := worktree.Checkout(&git.CheckoutOptions{Hash: *hash, Force: true}); err != nil {
return errors.Wrap(err, fmt.Sprintf("error while checking out git repo with hash [%v]", hash.String()))
}
// For some reason, when we use the worktree.Checkout, it seems to fail a lot in CI with errors
// test panicked: error while checking out git repo with hash [a77bbe8ae0d42697a38069a9749cfe71c2dafbe6]:
// open /home/ubuntu/actions-runner/_work/dgraph/repo/ee/updatemanifest: no such file or directory
// Until we know why that is happening, I [Aman] have moved to use the git command line tool.
cmd := exec.Command("git", "checkout", "-f", hash.String())
cmd.Dir = repoDir
if out, err := cmd.CombinedOutput(); err != nil {
return errors.Wrapf(err, "error while checking out hash [%v]\noutput:%v", hash.String(), string(out))
}
// worktree, err := repo.Worktree()
// if err != nil {
// return errors.Wrap(err, "error while getting git repo work tree")
// }
// if err := worktree.Checkout(&git.CheckoutOptions{Hash: *hash, Force: true}); err != nil {
// return errors.Wrap(err, fmt.Sprintf("error while checking out git repo with hash [%v]", hash.String()))
// }
return nil
}

Expand Down
5 changes: 3 additions & 2 deletions dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

"github.com/dgraph-io/dgo/v230"
"github.com/dgraph-io/dgo/v230/protos/api"
"github.com/dgraph-io/dgraph/x"
)

// cluster's network struct
Expand Down Expand Up @@ -485,7 +486,7 @@ func (c *LocalCluster) Upgrade(version string, strategy UpgradeStrategy) error {
if err != nil {
return err
}
if err := hc.LoginIntoNamespace(DefaultUser, DefaultPassword, 0); err != nil {
if err := hc.LoginIntoNamespace(DefaultUser, DefaultPassword, x.GalaxyNamespace); err != nil {
return errors.Wrapf(err, "error during login before upgrade")
}
if err := hc.Backup(c, true, DefaultBackupDir); err != nil {
Expand Down Expand Up @@ -514,7 +515,7 @@ func (c *LocalCluster) Upgrade(version string, strategy UpgradeStrategy) error {
if err != nil {
return errors.Wrapf(err, "error creating HTTP client after upgrade")
}
if err := hc.LoginIntoNamespace(DefaultUser, DefaultPassword, 0); err != nil {
if err := hc.LoginIntoNamespace(DefaultUser, DefaultPassword, x.GalaxyNamespace); err != nil {
return errors.Wrapf(err, "error during login after upgrade")
}
if err := hc.Restore(c, DefaultBackupDir, "", 0, 1, encPath); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion query/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestMain(m *testing.M) {

hc, err := c.HTTPClient()
x.Panic(err)
x.Panic(hc.LoginIntoNamespace(dgraphtest.DefaultUser, dgraphtest.DefaultPassword, 0))
x.Panic(hc.LoginIntoNamespace(dgraphtest.DefaultUser, dgraphtest.DefaultPassword, x.GalaxyNamespace))

mutate(c)
x.Panic(c.Upgrade(uc.After, uc.Strategy))
Expand Down

0 comments on commit f5802d7

Please sign in to comment.