Skip to content

Commit

Permalink
fix(ci): delete all issue in upgrade test (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil-goel authored Jan 28, 2025
1 parent 3c27935 commit c0789e2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ func (mm *MutableLayer) print() string {
mm.deleteAllMarker)
}

func (l *List) print() string {
return fmt.Sprintf("minTs: %d, plist: %+v, mutationMap: %s", l.minTs, l.plist, l.mutationMap.print())
}

// Return if piterator needs to be searched or not after mutable map and the posting if found.
func (mm *MutableLayer) findPosting(readTs, uid uint64) (bool, *pb.Posting) {
if mm == nil {
Expand Down Expand Up @@ -1119,7 +1123,7 @@ func (l *List) iterate(readTs uint64, afterUid uint64, f func(obj *pb.Posting) e
// pitr iterates through immutable postings
err = pitr.seek(l, afterUid, deleteBelowTs)
if err != nil {
return errors.Wrapf(err, "cannot initialize iterator when calling List.iterate")
return errors.Wrapf(err, "cannot initialize iterator when calling List.iterate "+l.print())
}

loop:
Expand Down
4 changes: 4 additions & 0 deletions systest/mutations-and-queries/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func (ssuite *SystestTestSuite) SetupSubTest() {
require.NoError(t, gcli.DropAll())
}

func (ssuite *SystestTestSuite) CheckAllowedErrorPreUpgrade(err error) bool {
return false
}

func (ssuite *SystestTestSuite) Upgrade() {
// Not implemented for integration tests
}
Expand Down
8 changes: 7 additions & 1 deletion systest/mutations-and-queries/mutations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2935,7 +2935,13 @@ func (ssuite *SystestTestSuite) DeleteAndQuerySameTxn() {

q := `{ me(func: has(name)) { name } }`
resp, err := txn2.Query(ctx, q)
require.NoError(t, err)
if err != nil {
if !ssuite.CheckAllowedErrorPreUpgrade(err) {
require.NoError(t, err)
} else {
t.Skip()
}
}
dgraphapi.CompareJSON(`{"me":[{"name":"Alice"}]}`,
string(resp.GetJson()))
require.NoError(t, txn2.Commit(ctx))
Expand Down
10 changes: 10 additions & 0 deletions systest/mutations-and-queries/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package main
import (
"errors"
"log"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -57,6 +58,15 @@ func (ssuite *SystestTestSuite) TearDownSubTest() {
ssuite.lc.Cleanup(ssuite.T().Failed())
}

func (ssuite *SystestTestSuite) CheckAllowedErrorPreUpgrade(err error) bool {
if val, checkErr := dgraphtest.IsHigherVersion(
ssuite.dc.GetVersion(),
"315747a19e9d5c5b98055c8b943a6e6462153bb3"); checkErr == nil && val || checkErr != nil {
return false
}
return strings.Contains(err.Error(), "cannot initialize iterator when calling List.iterate: deleteBelowTs")
}

func (ssuite *SystestTestSuite) Upgrade() {
require.NoError(ssuite.T(), ssuite.lc.Upgrade(ssuite.uc.After, ssuite.uc.Strategy))
}
Expand Down

0 comments on commit c0789e2

Please sign in to comment.