-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): muted warnings in CI runs due to cache conflicts
Every time a job is posted, I receive false alarm failure notifications because of some cache conflict during the linting job. Reference: golangci/golangci-lint-action#807 * added unit tests to internal package Signed-off-by: Frederic BIDON <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
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,39 @@ | ||
package internal | ||
|
||
import ( | ||
"net/url" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestUrlnorm(t *testing.T) { | ||
testCases := []struct { | ||
url string | ||
expected string | ||
}{ | ||
{ | ||
url: "HTTPs://xYz.cOm:443/folder//file", | ||
expected: "https://xyz.com/folder/file", | ||
}, | ||
{ | ||
url: "HTTP://xYz.cOm:80/folder//file", | ||
expected: "http://xyz.com/folder/file", | ||
}, | ||
{ | ||
url: "postGRES://xYz.cOm:5432/folder//file", | ||
expected: "postgres://xyz.com:5432/folder/file", | ||
}, | ||
} | ||
|
||
for _, toPin := range testCases { | ||
testCase := toPin | ||
|
||
u, err := url.Parse(testCase.url) | ||
require.NoError(t, err) | ||
|
||
NormalizeURL(u) | ||
assert.Equal(t, testCase.expected, u.String()) | ||
} | ||
} |