Skip to content

Commit

Permalink
chore(upgrade): run upgrade tests for v23.0.1
Browse files Browse the repository at this point in the history
This PR also fixes a bug in the code that compares the running
Dgraph version vs the expected version. It is possible that
the version is specified in e.g. long git hash format whereas
we use the short git hash format of Dgraph version in the logs.
  • Loading branch information
mangalaman93 committed Jul 28, 2023
1 parent 165d073 commit 6257f3b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 31 deletions.
60 changes: 30 additions & 30 deletions dgraphtest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,43 @@ type UpgradeCombo struct {
func AllUpgradeCombos() []UpgradeCombo {
fixedVersionCombos := []UpgradeCombo{
// OPEN SOURCE RELEASES
{"v21.03.0", "v23.0.0", BackupRestore},
{"v21.03.0-92-g0c9f60156", "v23.0.0", BackupRestore},
{"v21.03.0-98-g19f71a78a-slash", "v23.0.0", BackupRestore},
{"v21.03.0-99-g4a03c144a-slash", "v23.0.0", BackupRestore},
{"v21.03.1", "v23.0.0", BackupRestore},
{"v21.03.2", "v23.0.0", BackupRestore},
{"v22.0.0", "v23.0.0", BackupRestore},
{"v22.0.1", "v23.0.0", BackupRestore},
{"v22.0.2", "v23.0.0", BackupRestore},
{"v21.03.0", "v23.0.1", BackupRestore},
{"v21.03.0-92-g0c9f60156", "v23.0.1", BackupRestore},
{"v21.03.0-98-g19f71a78a-slash", "v23.0.1", BackupRestore},
{"v21.03.0-99-g4a03c144a-slash", "v23.0.1", BackupRestore},
{"v21.03.1", "v23.0.1", BackupRestore},
{"v21.03.2", "v23.0.1", BackupRestore},
{"v22.0.0", "v23.0.1", BackupRestore},
{"v22.0.1", "v23.0.1", BackupRestore},
{"v22.0.2", "v23.0.1", BackupRestore},

// CLOUD VERSIONS
{"e3d3e6290", "v23.0.0", BackupRestore}, // v21.03.0-48-ge3d3e6290
{"8b9e92314", "v23.0.0", BackupRestore}, // v21.03.0-63-g8b9e92314
{"dfa5daec1", "v23.0.0", BackupRestore}, // v21.03.0-66-gdfa5daec1
{"88e4aa07c", "v23.0.0", BackupRestore}, // v21.03.0-69-g88e4aa07c
{"d9df244fb", "v23.0.0", BackupRestore}, // v21.03.0-73-gd9df244fb
{"ed09b8cc1", "v23.0.0", BackupRestore}, // v21.03.0-76-ged09b8cc1
{"e4ad0b113", "v23.0.0", BackupRestore}, // v21.03.0-78-ge4ad0b113
{"83c9cbedc", "v23.0.0", BackupRestore}, // v21.03.0-82-g83c9cbedc
{"c5862ae2a", "v23.0.0", BackupRestore}, // v21.03.0-84-gc5862ae2a
{"e3d3e6290", "v23.0.1", BackupRestore}, // v21.03.0-48-ge3d3e6290
{"8b9e92314", "v23.0.1", BackupRestore}, // v21.03.0-63-g8b9e92314
{"dfa5daec1", "v23.0.1", BackupRestore}, // v21.03.0-66-gdfa5daec1
{"88e4aa07c", "v23.0.1", BackupRestore}, // v21.03.0-69-g88e4aa07c
{"d9df244fb", "v23.0.1", BackupRestore}, // v21.03.0-73-gd9df244fb
{"ed09b8cc1", "v23.0.1", BackupRestore}, // v21.03.0-76-ged09b8cc1
{"e4ad0b113", "v23.0.1", BackupRestore}, // v21.03.0-78-ge4ad0b113
{"83c9cbedc", "v23.0.1", BackupRestore}, // v21.03.0-82-g83c9cbedc
{"c5862ae2a", "v23.0.1", BackupRestore}, // v21.03.0-84-gc5862ae2a

// In place upgrade for cloud versions
{"e3d3e6290", "v23.0.0", InPlace}, // v21.03.0-48-ge3d3e6290
{"8b9e92314", "v23.0.0", InPlace}, // v21.03.0-63-g8b9e92314
{"dfa5daec1", "v23.0.0", InPlace}, // v21.03.0-66-gdfa5daec1
{"88e4aa07c", "v23.0.0", InPlace}, // v21.03.0-69-g88e4aa07c
{"d9df244fb", "v23.0.0", InPlace}, // v21.03.0-73-gd9df244fb
{"ed09b8cc1", "v23.0.0", InPlace}, // v21.03.0-76-ged09b8cc1
{"e4ad0b113", "v23.0.0", InPlace}, // v21.03.0-78-ge4ad0b113
{"83c9cbedc", "v23.0.0", InPlace}, // v21.03.0-82-g83c9cbedc
{"c5862ae2a", "v23.0.0", InPlace}, // v21.03.0-84-gc5862ae2a
{"0c9f60156", "v23.0.0", InPlace}, // v21.03.0-92-g0c9f60156
{"e3d3e6290", "v23.0.1", InPlace}, // v21.03.0-48-ge3d3e6290
{"8b9e92314", "v23.0.1", InPlace}, // v21.03.0-63-g8b9e92314
{"dfa5daec1", "v23.0.1", InPlace}, // v21.03.0-66-gdfa5daec1
{"88e4aa07c", "v23.0.1", InPlace}, // v21.03.0-69-g88e4aa07c
{"d9df244fb", "v23.0.1", InPlace}, // v21.03.0-73-gd9df244fb
{"ed09b8cc1", "v23.0.1", InPlace}, // v21.03.0-76-ged09b8cc1
{"e4ad0b113", "v23.0.1", InPlace}, // v21.03.0-78-ge4ad0b113
{"83c9cbedc", "v23.0.1", InPlace}, // v21.03.0-82-g83c9cbedc
{"c5862ae2a", "v23.0.1", InPlace}, // v21.03.0-84-gc5862ae2a
{"0c9f60156", "v23.0.1", InPlace}, // v21.03.0-92-g0c9f60156
}

mainCombos := []UpgradeCombo{
{"v23.0.0", "local", BackupRestore},
{"v23.0.0", "local", InPlace},
{"v23.0.1", "local", BackupRestore},
{"v23.0.1", "local", InPlace},
}

if os.Getenv("DGRAPH_UPGRADE_MAIN_ONLY") == "true" {
Expand Down
10 changes: 10 additions & 0 deletions dgraphtest/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ func runGitCheckout(gitRef string) error {
return nil
}

func getHash(ref string) (string, error) {
cmd := exec.Command("git", "rev-parse", ref)
cmd.Dir = repoDir
if out, err := cmd.CombinedOutput(); err != nil {
return "", errors.Wrapf(err, "error while running rev-parse on [%v]\noutput:%v", ref, string(out))
} else {
return string(out), nil
}
}

func buildDgraphBinary(dir, binaryDir, version string) error {
log.Printf("[INFO] building dgraph binary for version [%v]", version)

Expand Down
12 changes: 11 additions & 1 deletion dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,17 @@ func (c *LocalCluster) checkDgraphVersion(containerID string) error {
if err != nil {
return errors.Wrapf(err, "error during checkDgraphVersion for container [%v]", containerID)
}
if !strings.Contains(contLogs, fmt.Sprintf("Dgraph version : %v", c.GetVersion())) {
index := strings.Index(contLogs, "Dgraph version : ")
running := strings.Fields(contLogs[index:70])[3] // 70 is arbitrary
chash, err := getHash(c.GetVersion())
if err != nil {
return errors.Wrapf(err, "error while getting hash for %v", c.GetVersion())
}
rhash, err := getHash(running)
if err != nil {
return errors.Wrapf(err, "error while getting hash for %v", c.GetVersion())
}
if chash != rhash {
return errors.Errorf("found different dgraph version than expected [%v]", c.GetVersion())
}
return nil
Expand Down

0 comments on commit 6257f3b

Please sign in to comment.