Skip to content

Commit

Permalink
fix codecov settings
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Paskal <[email protected]>
  • Loading branch information
maksim-paskal committed Mar 20, 2024
1 parent af9a7d3 commit bc4d915
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ignore:
# ignore cmd/main.go because it's a main file
- "cmd/main.go"
# ignore because to test need active connection to the Telegram
- "pkg/alert/alert.go"
# ignore because to test need active connection to the kubernetes cluster
- "pkg/web/web.go"
- "pkg/api/api.go"
- "pkg/events/events.go"
- "pkg/client/client.go"
13 changes: 6 additions & 7 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,17 @@ func TestConfig(t *testing.T) {
},
}

for _, testCase := range testCases {
tc := testCase
t.Run(testCase.testName, func(t *testing.T) {
for i := range testCases {
t.Run(testCases[i].testName, func(t *testing.T) {
newConfig := config.Type{
TaintEffect: &tc.taintEffect,
NodeName: &tc.nodeName,
TelegramChatID: &tc.telegramID,
TaintEffect: &testCases[i].taintEffect,
NodeName: &testCases[i].nodeName,
TelegramChatID: &testCases[i].telegramID,
}
config.Set(newConfig)
err := config.Check()

if tc.err {
if testCases[i].err {
require.Error(t, err)
} else {
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func printType(prefix string, message interface{}) {
v := reflect.ValueOf(message)
typeOfS := v.Type()

for i := 0; i < v.NumField(); i++ {
for i := range v.NumField() {
switch typeOfS.Field(i).Name {
case "Template":
case "Event":
Expand Down
2 changes: 0 additions & 2 deletions pkg/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ func TestAzureResource(t *testing.T) {
})

for testID, test := range tests {
test := test

t.Run("Test"+strconv.Itoa(testID), func(t *testing.T) {
t.Parallel()

Expand Down
5 changes: 2 additions & 3 deletions pkg/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,8 @@ func TestWebHook(t *testing.T) { //nolint:funlen,tparallel
}
}

for _, test := range tests { //nolint:paralleltest
tc := test
t.Run(test.Name, func(t *testing.T) {
for _, tc := range tests { //nolint:paralleltest
t.Run(tc.Name, func(t *testing.T) {
cleanAllFlags()

for key, value := range tc.Args {
Expand Down

0 comments on commit bc4d915

Please sign in to comment.