@@ -231,7 +231,28 @@ func TestEnsureLoadBalancer_Create(t *testing.T) {
231231 _ , err := p .EnsureLoadBalancer (t .Context (), "foo" , svc , []* corev1.Node {& vmNode })
232232 require .ErrorIs (t , err , cloud .ErrLoadBalancerIsNotReady )
233233 })
234- t .Run ("A subnet is found, event if subnets are not tagged by owner" , func (t * testing.T ) {
234+ t .Run ("A subnet is found, even if no subnet exists in the right subregion" , func (t * testing.T ) {
235+ svc := testSvc ()
236+ c , oapimock , lbmock := newAPI (t , self , []string {"foo" })
237+ expectVMs (oapimock , sdkSelf , sdkVM )
238+ expectNoLoadbalancer (oapimock )
239+ expectFindLBSubnetWithRoleButAnotherSubregion (oapimock )
240+ expectSGAlreadyExists (oapimock )
241+ expectFindWorkerSGByRole (oapimock )
242+ expectAddIngressSGRule (oapimock , []string {"0.0.0.0/0" }, "sg-foo" )
243+ expectAddInternalSGRule (oapimock , "sg-foo" , "sg-worker" )
244+ expectCreateLoadBalancer (oapimock , func (clbr * osc.CreateLoadBalancerRequest ) {
245+ clbr .Subnets = & []string {"subnet-service" }
246+ })
247+ expectConfigureHealthCheck (oapimock )
248+ expectDescribeProxyProtocol (lbmock , false )
249+ expectDescribeLoadBalancerAttributes (lbmock )
250+ expectRegisterInstances (oapimock , sdkVM .VmId )
251+ p := ccm .NewProviderWith (c , staticDNSResolver {}, ccm.Options {})
252+ _ , err := p .EnsureLoadBalancer (t .Context (), "foo" , svc , []* corev1.Node {& vmNode })
253+ require .Error (t , err )
254+ })
255+ t .Run ("A subnet is found, even if subnets are not tagged by owner" , func (t * testing.T ) {
235256 svc := testSvc ()
236257 c , oapimock , lbmock := newAPI (t , self , []string {"foo" })
237258 expectVMs (oapimock , sdkSelf , sdkVM )
0 commit comments