diff --git a/go.mod b/go.mod index c3b7018f..4d238a6d 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 - github.com/hetznercloud/hcloud-go/v2 v2.10.2 + github.com/hetznercloud/hcloud-go/v2 v2.11.0 github.com/kubernetes-csi/csi-test/v5 v5.2.0 github.com/prometheus/client_golang v1.19.1 github.com/stretchr/testify v1.9.0 @@ -37,7 +37,7 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.48.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/net v0.27.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect diff --git a/go.sum b/go.sum index ff12cb59..c3615b50 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/hetznercloud/hcloud-go/v2 v2.10.1 h1:MLfIJJvl7qo79Q+52YmrJ4BOTL5oICJW github.com/hetznercloud/hcloud-go/v2 v2.10.1/go.mod h1:xQ+8KhIS62W0D78Dpi57jsufWh844gUw1az5OUvaeq8= github.com/hetznercloud/hcloud-go/v2 v2.10.2 h1:9gyTUPhfNbfbS40Spgij5mV5k37bOZgt8iHKCbfGs5I= github.com/hetznercloud/hcloud-go/v2 v2.10.2/go.mod h1:xQ+8KhIS62W0D78Dpi57jsufWh844gUw1az5OUvaeq8= +github.com/hetznercloud/hcloud-go/v2 v2.11.0 h1:U1wD58/trMnKO6aHy2i2aguT5USwWbzC2hWj3r2sidE= +github.com/hetznercloud/hcloud-go/v2 v2.11.0/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -132,6 +134,8 @@ golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/api/volume_test.go b/internal/api/volume_test.go index 7e781627..fe776c4e 100644 --- a/internal/api/volume_test.go +++ b/internal/api/volume_test.go @@ -4,7 +4,6 @@ import ( "context" "net/http/httptest" "testing" - "time" "github.com/go-kit/log" "github.com/stretchr/testify/assert" @@ -12,21 +11,21 @@ import ( "github.com/hetznercloud/csi-driver/internal/csi" "github.com/hetznercloud/csi-driver/internal/volumes" "github.com/hetznercloud/hcloud-go/v2/hcloud" - "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils" + "github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil" "github.com/hetznercloud/hcloud-go/v2/hcloud/schema" ) var _ volumes.Service = (*VolumeService)(nil) -func makeTestVolumeService(t *testing.T, requests []mockutils.Request) (*VolumeService, func()) { +func makeTestVolumeService(t *testing.T, requests []mockutil.Request) (*VolumeService, func()) { t.Helper() - testServer := httptest.NewServer(mockutils.Handler(t, requests)) + testServer := httptest.NewServer(mockutil.Handler(t, requests)) testClient := hcloud.NewClient( hcloud.WithEndpoint(testServer.URL), - hcloud.WithBackoffFunc(func(_ int) time.Duration { return 0 }), - hcloud.WithPollBackoffFunc(func(_ int) time.Duration { return 0 }), + hcloud.WithRetryOpts(hcloud.RetryOpts{BackoffFunc: hcloud.ConstantBackoff(0), MaxRetries: 3}), + hcloud.WithPollBackoffFunc(hcloud.ConstantBackoff(0)), ) volumeService := NewVolumeService(log.NewNopLogger(), testClient) @@ -37,7 +36,7 @@ func makeTestVolumeService(t *testing.T, requests []mockutils.Request) (*VolumeS func TestResize(t *testing.T) { t.Run("ErrVolumeSizeAlreadyReached", func(t *testing.T) { t.Run("happy with larger volume size", func(t *testing.T) { - volumeService, cleanup := makeTestVolumeService(t, []mockutils.Request{ + volumeService, cleanup := makeTestVolumeService(t, []mockutil.Request{ { Method: "GET", Path: "/volumes/1", Status: 200, @@ -60,7 +59,7 @@ func TestResize(t *testing.T) { }) t.Run("with equal volume size", func(t *testing.T) { - volumeService, cleanup := makeTestVolumeService(t, []mockutils.Request{ + volumeService, cleanup := makeTestVolumeService(t, []mockutil.Request{ { Method: "GET", Path: "/volumes/1", Status: 200, @@ -76,7 +75,7 @@ func TestResize(t *testing.T) { }) t.Run("with smaller volume size", func(t *testing.T) { - volumeService, cleanup := makeTestVolumeService(t, []mockutils.Request{ + volumeService, cleanup := makeTestVolumeService(t, []mockutil.Request{ { Method: "GET", Path: "/volumes/1", Status: 200,