Skip to content
Merged
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
Prev Previous commit
Next Next commit
compensate for how Version parsing works
  • Loading branch information
mgravell committed Mar 20, 2026
commit 53f4db29b13bb49cdfa69482b2b2691ca188dd58
19 changes: 12 additions & 7 deletions tests/NRedisStack.Tests/EndpointsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,24 @@ public static IEnumerable<object[]> StandaloneOnly()
public static bool IsAtLeast(int major, int minor = 0, int build = 0, int revision = 0)
{
var version = RedisVersion;
if (version.Major > major) return true;
if (version.Major < major) return false;
// note: watch out for negative numbers (means "undefined") from parsing n-part strings
var test = Math.Max(version.Major, 0);
if (test > major) return true;
if (test < major) return false;

// if here, we're a match on major; test minor
if (version.Minor > minor) return true;
if (version.Minor < minor) return false;
test = Math.Max(version.Minor, 0); // interpret "9" as "9.0"
if (test > minor) return true;
if (test < minor) return false;

// if here, we're a match on minor; test build
if (version.Build > build) return true;
if (version.Build < build) return false;
test = Math.Max(version.Build, 0); // interpret "9.0" as "9.0.0"
if (test > build) return true;
if (test < build) return false;

// if here, we're a match on build; test revision
return version.Revision >= revision;
test = Math.Max(version.Revision, 0); // interpret "9.0.0" as "9.0.0.0"
return test >= revision;
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

public EndpointsFixture()
Expand Down
Loading