-
Notifications
You must be signed in to change notification settings - Fork 171
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
feat: allow Gateways to filter by pre-release #3111
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -339,12 +339,40 @@ func TestCapability_CompatibleWithNetCap(t *testing.T) { | |
orch.version = "0.4.0" | ||
assert.False(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
|
||
// broadcaster is not compatible with orchestrator - the same version | ||
// broadcaster is compatible with orchestrator - the same version | ||
orch = NewCapabilities(nil, nil) | ||
bcast = NewCapabilities(nil, nil) | ||
bcast.constraints.minVersion = "0.4.1" | ||
orch.version = "0.4.1" | ||
assert.True(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
|
||
// broadcaster is compatible with orchestrator - no pre-release min version suffix | ||
orch = NewCapabilities(nil, nil) | ||
bcast = NewCapabilities(nil, nil) | ||
bcast.constraints.minVersion = "0.4.1" | ||
orch.version = "0.4.1-0.21000000000000-06f1f383fb18" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh if our versions are like this and not like |
||
assert.True(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
|
||
// broadcaster is not compatible with orchestrator - no pre-release O's version | ||
orch = NewCapabilities(nil, nil) | ||
bcast = NewCapabilities(nil, nil) | ||
bcast.constraints.minVersion = "0.4.1-0.20000000000000-06f1f383fb18" | ||
orch.version = "0.4.1" | ||
assert.False(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
|
||
// broadcaster is not compatible with orchestrator pre-release - old O's version | ||
orch = NewCapabilities(nil, nil) | ||
bcast = NewCapabilities(nil, nil) | ||
bcast.constraints.minVersion = "0.4.1-0.21000000000000-06f1f383fb18" | ||
orch.version = "0.4.1-0.20000000000000-06f1f383fb18" | ||
assert.False(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
|
||
// broadcaster is compatible with orchestrator pre-release - higher O's version | ||
orch = NewCapabilities(nil, nil) | ||
bcast = NewCapabilities(nil, nil) | ||
bcast.constraints.minVersion = "0.4.1-0.20000000000000-06f1f383fb18" | ||
orch.version = "0.4.1-0.21000000000000-06f1f383fb18" | ||
assert.True(bcast.CompatibleWith(orch.ToNetCapabilities())) | ||
} | ||
|
||
func TestCapability_RoundTrip_Net(t *testing.T) { | ||
|
@@ -568,6 +596,30 @@ func TestLiveeerVersionCompatibleWith(t *testing.T) { | |
transcoderVersion: "nonparsablesemversion", | ||
expected: false, | ||
}, | ||
{ | ||
name: "broadcaster required version has no pre-release", | ||
broadcasterMinVersion: "0.4.1", | ||
transcoderVersion: "0.4.1-0.21000000000000-06f1f383fb18", | ||
expected: true, | ||
}, | ||
{ | ||
name: "transcoder version has no pre-release", | ||
broadcasterMinVersion: "0.4.1-0.21000000000000-06f1f383fb18", | ||
transcoderVersion: "0.4.1", | ||
expected: false, | ||
}, | ||
{ | ||
name: "broadcaster required pre-release version is higher than transcoder pre-release version", | ||
broadcasterMinVersion: "0.4.1-0.21000000000000-06f1f383fb18", | ||
transcoderVersion: "0.4.1-0.20000000000000-06f1f383fb18", | ||
expected: false, | ||
}, | ||
{ | ||
name: "broadcaster required pre-release version is lower than transcoder pre-release version", | ||
broadcasterMinVersion: "0.4.1-0.20000000000000-06f1f383fb18", | ||
transcoderVersion: "0.4.1-0.21000000000000-06f1f383fb18", | ||
expected: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this logic since
Masterminds/semver
already implements proper pre-release comparison, considering pre-releases lower than the release version. Their code is pretty straightforwad, can dig intoLessThan
implementation below to understand what they do