Skip to content

Commit

Permalink
Fix linter rule violations (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertvolkmann authored Dec 14, 2023
1 parent 635e5f9 commit 5ca1854
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dhcp4/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func testConn(t *testing.T, impl conn, addr string) {
Expand Down Expand Up @@ -55,7 +55,7 @@ func testConn(t *testing.T, impl conn, addr string) {

go func() {
_, err := s.Write(bs)
assert.NoError(t, err)
require.NoError(t, err)
}()
if err = c.SetReadDeadline(time.Now().Add(time.Second)); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -86,7 +86,7 @@ func testConn(t *testing.T, impl conn, addr string) {
ch := make(chan *Packet, 1)
go func() {
err := s.SetReadDeadline(time.Now().Add(time.Second))
assert.NoError(t, err)
require.NoError(t, err)
var buf [1500]byte
n, err := s.Read(buf[:])
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions dhcp6/pool/random_address_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestReserveAddress(t *testing.T) {
Expand Down Expand Up @@ -60,7 +60,7 @@ func TestReserveAddressUpdatesAddressPool(t *testing.T) {
pool := NewRandomAddressPool(net.ParseIP("2001:db8:f00f:cafe::1"), 1, expectedMaxLifetime)
pool.timeNow = func() time.Time { return expectedTime }
_, err := pool.ReserveAddresses(expectedClientID, [][]byte{expectedIAID})
assert.NoError(t, err)
require.NoError(t, err)

expectedIdx := pool.calculateIAIDHash(expectedClientID, expectedIAID)

Expand All @@ -83,7 +83,7 @@ func TestReserveAddressKeepsTrackOfUsedAddresses(t *testing.T) {
pool := NewRandomAddressPool(net.ParseIP("2001:db8:f00f:cafe::1"), 1, expectedMaxLifetime)
pool.timeNow = func() time.Time { return expectedTime }
_, err := pool.ReserveAddresses(expectedClientID, [][]byte{expectedIAID})
assert.NoError(t, err)
require.NoError(t, err)
_, exists := pool.usedIps[0x01]
if !exists {
t.Fatal("'2001:db8:f00f:cafe::1' should be marked as in use")
Expand All @@ -99,8 +99,8 @@ func TestReserveAddressKeepsTrackOfAssociationExpiration(t *testing.T) {
pool := NewRandomAddressPool(net.ParseIP("2001:db8:f00f:cafe::1"), 1, expectedMaxLifetime)
pool.timeNow = func() time.Time { return expectedTime }
_, err := pool.ReserveAddresses(expectedClientID, [][]byte{expectedIAID})
assert.NoError(t, err)
require.NoError(t, err)

expiration := pool.identityAssociationExpirations.Peek().(*associationExpiration)
if expiration == nil {
t.Fatal("Expected an identity association expiration, but got nil")
Expand Down
9 changes: 5 additions & 4 deletions pixiecore/booters.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import (
"text/template"
"time"

"go.uber.org/zap"

v1 "github.com/metal-stack/metal-api/pkg/api/v1"
"github.com/metal-stack/pixie/api"
"go.uber.org/zap"
)

// APIBooter gets a BootSpec from a remote server over HTTP.
Expand Down Expand Up @@ -111,14 +112,14 @@ func (g *grpcbooter) BootSpec(m Machine) (*Spec, error) {
}
g.log.Infow("boot", "resp", resp)

cmdline := []string{*resp.Cmdline, fmt.Sprintf("PIXIE_API_URL=%s", g.config.PixieAPIURL)}
cmdline := []string{resp.GetCmdline(), fmt.Sprintf("PIXIE_API_URL=%s", g.config.PixieAPIURL)}
if g.config.Debug {
cmdline = append(cmdline, "DEBUG=1")
}

r = rawSpec{
Kernel: resp.Kernel,
Initrd: resp.InitRamDisks,
Kernel: resp.GetKernel(),
Initrd: resp.GetInitRamDisks(),
Cmdline: strings.Join(cmdline, " "),
}
}
Expand Down

0 comments on commit 5ca1854

Please sign in to comment.