Skip to content

Commit

Permalink
Pick lint from connector_test
Browse files Browse the repository at this point in the history
  • Loading branch information
webbnh committed Oct 21, 2024
1 parent e3600c9 commit 6a22d6d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"go.arcalot.io/assert"
log "go.arcalot.io/log/v2"
"go.arcalot.io/log/v2"
"go.flow.arcalot.io/deployer"
"go.flow.arcalot.io/podmandeployer/tests"
)
Expand Down Expand Up @@ -577,7 +577,14 @@ func readOutputUntil(t *testing.T, plugin io.Reader, lookForOutput string) []byt
return readBuffer[:n]
}

func testNetworking(t *testing.T, podmanNetworking string, containerTest string, expectedOutput *string, ip *string, mac *string) {
func testNetworking(
t *testing.T,
podmanNetworking string,
containerTest string,
expectedOutput *string,
ip *string,
mac *string,
) {
logger := log.NewTestLogger(t)
assert.NoErrorR[string](t)(exec.LookPath("ifconfig"))

Expand Down Expand Up @@ -611,10 +618,12 @@ func testNetworking(t *testing.T, podmanNetworking string, containerTest string,
// assert the container input is not empty
assert.Equals(t, len(readBuffer) > 0, true)

if ip == nil && mac == nil && expectedOutput != nil {
if expectedOutput != nil {

Check failure on line 621 in connector_test.go

View workflow job for this annotation

GitHub Actions / lint and test / golangci-lint

ifElseChain: rewrite if-else to switch statement (gocritic)
assert.Contains(t, string(readBuffer), *expectedOutput)
} else {
} else if ip != nil && mac != nil {
assert.Contains(t, string(readBuffer), *ip)
assert.Contains(t, string(readBuffer), *mac)
} else {
t.Fatalf("Test bug: \"expectedOutput\" is nil AND \"ip\" or \"mac\" is too.")
}
}

0 comments on commit 6a22d6d

Please sign in to comment.