Skip to content

Commit

Permalink
fix(upgrade): check commit SHA to find running dgraph version (#8923)
Browse files Browse the repository at this point in the history
for certain binaries such as v22.0.0, dgraph version that gets printed
is "local". We now instead use the commit sha to find the right running
version of Dgraph for ensuring that we are running the version that we
expect to run.
  • Loading branch information
mangalaman93 authored Jul 31, 2023
1 parent 48b1d5f commit fd6c0be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dgraphtest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func AllUpgradeCombos() []UpgradeCombo {
}

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

if os.Getenv("DGRAPH_UPGRADE_MAIN_ONLY") == "true" {
Expand Down
4 changes: 2 additions & 2 deletions dgraphtest/local_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,15 @@ func (c *LocalCluster) checkDgraphVersion(containerID string) error {
if err != nil {
return errors.Wrapf(err, "error during checkDgraphVersion for container [%v]", containerID)
}
index := strings.Index(contLogs, "Dgraph version : ")
index := strings.Index(contLogs, "Commit SHA-1 : ")
running := strings.Fields(contLogs[index : 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())
return errors.Wrapf(err, "error while getting hash for %v", running)
}
if chash != rhash {
return errors.Errorf("found different dgraph version than expected [%v]", c.GetVersion())
Expand Down

0 comments on commit fd6c0be

Please sign in to comment.