Skip to content

Commit

Permalink
ING-949: Fixed testing issue related to MB-64026.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Lawson committed Oct 25, 2024
1 parent ad5bb30 commit 78cbeda
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 9 additions & 5 deletions memdx/ops_core_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ func TestOpsCoreGetCollectionIDScopeMissing(t *testing.T) {
})
require.ErrorIs(t, err, memdx.ErrUnknownScopeName)

var serverErr memdx.ServerErrorWithContext
require.ErrorAs(t, err, &serverErr)
serverCtx := serverErr.ParseContext()

require.NotEqual(t, 0, serverCtx.ManifestRev)
if testutilsint.IsServerVersionBetween(t, "7.6.0", "7.6.3") {
// MB-64026 caused context to be missing in these server versions
} else {
var serverErr memdx.ServerErrorWithContext
require.ErrorAs(t, err, &serverErr)
serverCtx := serverErr.ParseContext()

require.NotEqual(t, 0, serverCtx.ManifestRev)
}
}
8 changes: 8 additions & 0 deletions testutilsint/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ func IsOlderServerVersion(t *testing.T, checkVersion string) bool {
return semver.Compare("v"+serverVersion, "v"+checkVersion) < 0
}

// checks if server version is between start and end version inclusively
func IsServerVersionBetween(t *testing.T, startVersion, endVersion string) bool {
serverVersion := getServerVersion(t)
isEqualAfterStart := semver.Compare("v"+serverVersion, "v"+startVersion) >= 0
isAfterEnd := semver.Compare("v"+serverVersion, "v"+endVersion) > 0
return isEqualAfterStart && isAfterEnd
}

func SkipIfOlderServerVersion(t *testing.T, checkVersion string) {
serverVersion := getServerVersion(t)
if semver.Compare("v"+serverVersion, "v"+checkVersion) < 0 {
Expand Down

0 comments on commit 78cbeda

Please sign in to comment.