@@ -116,13 +116,6 @@ func TestCreateOrUpdateLoadbalancerWaitHandler(t *testing.T) {
116116 })
117117 }
118118}
119- func httpStatus (code int , status string ) * oapierror.GenericOpenAPIError {
120- return & oapierror.GenericOpenAPIError {
121- StatusCode : code ,
122- ErrorMessage : status ,
123- Model : map [string ]any {},
124- }
125- }
126119
127120func TestDeleteLoadbalancerWaitHandler (t * testing.T ) {
128121 tests := []struct {
@@ -133,7 +126,7 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) {
133126 {
134127 "Delete with '404' succeeded immediately" ,
135128 []response {
136- {nil , httpStatus (http .StatusNotFound , "not found" )},
129+ {nil , oapierror . NewError (http .StatusNotFound , "not found" )},
137130 },
138131 false ,
139132 },
@@ -143,14 +136,14 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) {
143136 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
144137 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
145138 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
146- {nil , httpStatus (http .StatusNotFound , "not found" )},
139+ {nil , oapierror . NewError (http .StatusNotFound , "not found" )},
147140 },
148141 false ,
149142 },
150143 {
151144 "Delete with 'gone' succeeded immediately" ,
152145 []response {
153- {nil , httpStatus (http .StatusGone , "gone" )},
146+ {nil , oapierror . NewError (http .StatusGone , "gone" )},
154147 },
155148 false ,
156149 },
@@ -160,7 +153,7 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) {
160153 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
161154 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
162155 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
163- {nil , httpStatus (http .StatusGone , "not found" )},
156+ {nil , oapierror . NewError (http .StatusGone , "not found" )},
164157 },
165158 false ,
166159 },
@@ -170,7 +163,7 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) {
170163 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
171164 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
172165 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
173- {& alb.LoadBalancer {Status : utils .Ptr (string (StatusError ))}, httpStatus (http .StatusInternalServerError , "kapow" )},
166+ {& alb.LoadBalancer {Status : utils .Ptr (string (StatusError ))}, oapierror . NewError (http .StatusInternalServerError , "kapow" )},
174167 },
175168 true ,
176169 },
@@ -180,7 +173,7 @@ func TestDeleteLoadbalancerWaitHandler(t *testing.T) {
180173 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
181174 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
182175 {& alb.LoadBalancer {Status : utils .Ptr (StatusPending )}, nil },
183- {& alb.LoadBalancer {Status : utils .Ptr (string (StatusError ))}, httpStatus (http .StatusOK , "ok" )},
176+ {& alb.LoadBalancer {Status : utils .Ptr (string (StatusError ))}, oapierror . NewError (http .StatusOK , "ok" )},
184177 },
185178 true ,
186179 },
0 commit comments