Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade): look for version string in logs bottom up #8926

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dgraphtest/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -137,7 +138,7 @@ func getHash(ref string) (string, error) {
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
return strings.TrimSpace(string(out)), nil
}
}

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,7 +781,7 @@ 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, "Commit SHA-1 : ")
index := strings.LastIndex(contLogs, "Commit SHA-1 : ")
running := strings.Fields(contLogs[index : index+70])[3] // 70 is arbitrary
chash, err := getHash(c.GetVersion())
if err != nil {
Expand All @@ -792,7 +792,7 @@ func (c *LocalCluster) checkDgraphVersion(containerID string) error {
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())
return errors.Errorf("found different dgraph version [%v] than expected [%v]", rhash, chash)
}
return nil
}
Expand Down