Skip to content

Commit 91d0edd

Browse files
committed
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]>
1 parent 23cc9cc commit 91d0edd

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.github/workflows/go-test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
with:
1919
version: latest
2020
only-new-issues: true
21+
skip-cache: true
2122

2223
test:
2324
name: Unit tests
@@ -38,7 +39,7 @@ jobs:
3839

3940
- uses: actions/checkout@v3
4041

41-
- run: go test -v -race -coverprofile="coverage-${{ matrix.os }}.${{ matrix.go_version }}.out" -covermode=atomic ./...
42+
- run: go test -v -race -coverprofile="coverage-${{ matrix.os }}.${{ matrix.go_version }}.out" -covermode=atomic -coverpkg=$(go list)/... ./...
4243

4344
- name: Upload coverage to codecov
4445
uses: codecov/codecov-action@v3

internal/normalize_url_test.go

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package internal
2+
3+
import (
4+
"net/url"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
func TestUrlnorm(t *testing.T) {
12+
testCases := []struct {
13+
url string
14+
expected string
15+
}{
16+
{
17+
url: "HTTPs://xYz.cOm:443/folder//file",
18+
expected: "https://xyz.com/folder/file",
19+
},
20+
{
21+
url: "HTTP://xYz.cOm:80/folder//file",
22+
expected: "http://xyz.com/folder/file",
23+
},
24+
{
25+
url: "postGRES://xYz.cOm:5432/folder//file",
26+
expected: "postgres://xyz.com:5432/folder/file",
27+
},
28+
}
29+
30+
for _, toPin := range testCases {
31+
testCase := toPin
32+
33+
u, err := url.Parse(testCase.url)
34+
require.NoError(t, err)
35+
36+
NormalizeURL(u)
37+
assert.Equal(t, testCase.expected, u.String())
38+
}
39+
}

0 commit comments

Comments
 (0)