Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ public ContentSourceMatch Match(ILoggerFactory logFactory, string repository, st
logger.LogInformation("Current is not using versioned branches and is not publishing to the registry yet, using product information to determine speculative build is needed");
var productVersion = versioningSystem.Current;
var anchoredProductVersion = new SemVersion(productVersion.Major, productVersion.Minor, 0);
if (v >= anchoredProductVersion)
if (v > anchoredProductVersion)
{
logger.LogInformation("Speculative build {Branch} is gte product current '{ProductCurrent}' anchored at {ProductAnchored}", branchOrTag,
logger.LogInformation("Speculative build {Branch} is gt product current '{ProductCurrent}' anchored at {ProductAnchored}", branchOrTag,
productVersion, anchoredProductVersion);
match = match with
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ public void VersionBranchSpeculativeBuildBasedOnCurrentVersion(string branch, st

[Theory]
[InlineData("8.16", "8.15", true)] // Greater than product version
[InlineData("8.15", "8.15", true)] // Equal to product version
[InlineData("8.15", "8.15", false)] // Equal to product version — current is served from main
[InlineData("8.14", "8.15", false)] // Previous minor version - but current is not versioned, so no previous minor logic
[InlineData("8.13", "8.15", false)] // Less than previous minor
[InlineData("8.0", "8.0", true)] // Edge case: minor version 0
[InlineData("8.0", "8.0", false)] // Edge case: equal at minor version 0
public void VersionBranchSpeculativeBuildBasedOnProductVersion(string branch, string productVersion, bool shouldBeSpeculative)
{
var repositories = new Dictionary<string, Repository>
Expand Down Expand Up @@ -267,10 +267,9 @@ public void CurrentVersionMatchAlsoSetsSpeculative()
}

[Theory]
[InlineData("9.0", "9.0.0")] // Matches anchored product version
[InlineData("9.1", "9.0.0")] // Greater than anchored product version
[InlineData("9.5", "9.0.0")] // Much greater than anchored product version
public void VersionBranchSpeculativeBuildWhenGreaterThanOrEqualToAnchoredProductVersion(string branch, string productVersion)
public void VersionBranchSpeculativeBuildWhenGreaterThanAnchoredProductVersion(string branch, string productVersion)
{
var repositories = new Dictionary<string, Repository>
{
Expand All @@ -289,7 +288,8 @@ public void VersionBranchSpeculativeBuildWhenGreaterThanOrEqualToAnchoredProduct
[InlineData("8.15", "9.0.0")] // Less than anchored product version
[InlineData("7.17", "9.0.0")] // Much less than anchored product version
[InlineData("8.0", "9.1.5")] // Less than anchored product version with patch
public void VersionBranchNoSpeculativeBuildWhenLessThanAnchoredProductVersionAndNotPreviousMinor(string branch, string productVersion)
[InlineData("9.0", "9.0.0")] // Equal to anchored product version — current is served from main
public void VersionBranchNoSpeculativeBuildWhenLessThanOrEqualToAnchoredProductVersionAndNotPreviousMinor(string branch, string productVersion)
{
var repositories = new Dictionary<string, Repository>
{
Expand Down Expand Up @@ -356,9 +356,9 @@ public void VersionBranchNoSpeculativeBuildWhenProductIsNull()
}

[Theory]
[InlineData("9.0", "9.0.15")] // Anchored version equals major.minor.0
[InlineData("9.0", "9.0.0")] // Anchored version equals major.minor.0
[InlineData("9.0", "9.0.1")] // Anchored version equals major.minor.0
[InlineData("9.1", "9.0.15")] // Anchored to 9.0.0, branch 9.1 > 9.0.0
[InlineData("9.1", "9.0.0")] // Anchored to 9.0.0, branch 9.1 > 9.0.0
[InlineData("9.1", "9.0.1")] // Anchored to 9.0.0, branch 9.1 > 9.0.0
public void VersionBranchAnchorsProductVersionToMinorZero(string branch, string productVersion)
{
var repositories = new Dictionary<string, Repository>
Expand All @@ -371,7 +371,6 @@ public void VersionBranchAnchorsProductVersionToMinorZero(string branch, string

var result = config.Match(LoggerFactory, "elastic/test-repo", branch, product, false);

// Should match because branch 9.0 >= anchored product version 9.0.0
result.Speculative.Should().BeTrue();
}

Expand All @@ -395,7 +394,6 @@ public void VersionBranchPreviousMinorCalculationHandlesEdgeCases(string branch,
}

[Theory]
[InlineData("9.0", "9.0.0")] // Matches anchored product version
[InlineData("9.1", "9.0.0")] // Greater than anchored product version
[InlineData("9.5", "9.0.0")] // Much greater than anchored product version
public void AlreadyPublishingTruePreventSpeculativeBuildForVersionBranch(string branch, string productVersion)
Expand All @@ -414,7 +412,6 @@ public void AlreadyPublishingTruePreventSpeculativeBuildForVersionBranch(string
}

[Theory]
[InlineData("9.0", "9.0.0")] // Matches anchored product version
[InlineData("9.1", "9.0.0")] // Greater than anchored product version
[InlineData("9.5", "9.0.0")] // Much greater than anchored product version
public void AlreadyPublishingFalseAllowsSpeculativeBuildForVersionBranch(string branch, string productVersion)
Expand Down
Loading