@@ -3,13 +3,14 @@ package ccm
33import (
44 "context"
55 "errors"
6+ "net/http"
67 "time"
78
89 . "github.com/onsi/ginkgo/v2"
910 . "github.com/onsi/gomega"
10- stackitclient "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/client"
1111 stackitclientmock "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/client/mock"
1212 stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config"
13+ oapiError "github.com/stackitcloud/stackit-sdk-go/core/oapierror"
1314 loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api"
1415 lbwait "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api/wait"
1516 "go.uber.org/mock/gomock"
@@ -100,7 +101,7 @@ var _ = Describe("LoadBalancer", func() {
100101
101102 Describe ("GetLoadBalancer" , func () {
102103 It ("should report LB does not exist" , func () {
103- mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , stackitclient . ErrorNotFound )
104+ mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , & oapiError. GenericOpenAPIError { StatusCode : http . StatusNotFound } )
104105
105106 svc := minimalLoadBalancerService ()
106107
@@ -190,7 +191,7 @@ var _ = Describe("LoadBalancer", func() {
190191
191192 Describe ("EnsureLoadBalancer" , func () {
192193 It ("ensure load balancer should trigger load balancer creation if LB doesn't exist" , func () {
193- mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , stackitclient . ErrorNotFound )
194+ mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , & oapiError. GenericOpenAPIError { StatusCode : http . StatusNotFound } )
194195 mockClient .EXPECT ().CreateLoadBalancer (gomock .Any (), gomock .Any ()).MinTimes (1 ).Return (& loadbalancer.LoadBalancer {}, nil )
195196
196197 _ , err := loadBalancer .EnsureLoadBalancer (context .Background (), clusterName , minimalLoadBalancerService (), []* corev1.Node {})
@@ -199,7 +200,7 @@ var _ = Describe("LoadBalancer", func() {
199200 })
200201
201202 It ("should create a load balancer with observability configured" , func () {
202- mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , stackitclient . ErrorNotFound )
203+ mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , & oapiError. GenericOpenAPIError { StatusCode : http . StatusNotFound } )
203204 mockClient .EXPECT ().ListCredentials (gomock .Any ()).Return (& loadbalancer.ListCredentialsResponse {
204205 Credentials : []loadbalancer.CredentialsResponse {},
205206 }, nil )
@@ -399,7 +400,7 @@ var _ = Describe("LoadBalancer", func() {
399400 })
400401
401402 It ("should finalize deletion if LB API returns not found" , func () {
402- mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , stackitclient . ErrorNotFound )
403+ mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , & oapiError. GenericOpenAPIError { StatusCode : http . StatusNotFound } )
403404
404405 err := loadBalancer .EnsureLoadBalancerDeleted (context .Background (), clusterName , minimalLoadBalancerService ())
405406 Expect (err ).NotTo (HaveOccurred ())
@@ -417,7 +418,7 @@ var _ = Describe("LoadBalancer", func() {
417418 })
418419
419420 It ("should report no error if LB not found" , func () {
420- mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , stackitclient . ErrorNotFound )
421+ mockClient .EXPECT ().GetLoadBalancer (gomock .Any (), gomock .Any ()).Return (nil , & oapiError. GenericOpenAPIError { StatusCode : http . StatusNotFound } )
421422
422423 svc := minimalLoadBalancerService ()
423424
0 commit comments