-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hub resolver: add version constraints
This let the user specify a version constraint to choose from. Version constraint looks like this: ```yaml version: ">= 0.5.0" ``` This will only choose the tasks that are greater than 0.5.0 Additional constraint operators are available, for example: ```yaml version: ">= 0.5.0, < 2.0.0" ``` This will only choose the tasks that are greater than 0.5.0 and less than 2.0.0 Signed-off-by: Chmouel Boudjnah <[email protected]>
- Loading branch information
1 parent
b958eb5
commit f0c7ed5
Showing
7 changed files
with
380 additions
and
17 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func TestBuildHubURL(t *testing.T) { | ||
testCases := []struct { | ||
name string | ||
configAPI string | ||
defaultURL string | ||
expected string | ||
}{ | ||
{ | ||
name: "configAPI empty", | ||
configAPI: "", | ||
defaultURL: "https://tekton.dev", | ||
expected: "https://tekton.dev", | ||
}, | ||
{ | ||
name: "configAPI not empty", | ||
configAPI: "https://myhub.com", | ||
defaultURL: "https://foo.com", | ||
expected: "https://myhub.com", | ||
}, | ||
{ | ||
name: "defaultURL ends with slash", | ||
configAPI: "", | ||
defaultURL: "https://bar.com/", | ||
expected: "https://bar.com", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
actual := buildHubURL(tc.configAPI, tc.defaultURL) | ||
if actual != tc.expected { | ||
t.Errorf("expected %s, but got %s", tc.expected, actual) | ||
} | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.