@@ -1448,6 +1448,48 @@ func TestLoadBalancerOps_ReconcileHCLBTargets(t *testing.T) {
1448
1448
1449
1449
func TestLoadBalancerOps_ReconcileHCLBServices (t * testing.T ) {
1450
1450
tests := []LBReconcilementTestCase {
1451
+ {
1452
+ name : "configure unsupported protocol" ,
1453
+ servicePorts : []corev1.ServicePort {
1454
+ {Port : 80 , NodePort : 8080 , Protocol : corev1 .ProtocolUDP },
1455
+ {Port : 443 , NodePort : 8443 , Protocol : corev1 .ProtocolUDP },
1456
+ },
1457
+ initialLB : & hcloud.LoadBalancer {
1458
+ ID : 4 ,
1459
+ LoadBalancerType : & hcloud.LoadBalancerType {
1460
+ MaxTargets : 25 ,
1461
+ },
1462
+ },
1463
+ mock : func (_ * testing.T , tt * LBReconcilementTestCase ) {
1464
+ opts := hcloud.LoadBalancerAddServiceOpts {
1465
+ Protocol : hcloud .LoadBalancerServiceProtocolTCP ,
1466
+ ListenPort : hcloud .Ptr (80 ),
1467
+ DestinationPort : hcloud .Ptr (8080 ),
1468
+ HealthCheck : & hcloud.LoadBalancerAddServiceOptsHealthCheck {
1469
+ Protocol : hcloud .LoadBalancerServiceProtocolTCP ,
1470
+ Port : hcloud .Ptr (8080 ),
1471
+ },
1472
+ }
1473
+ action := tt .fx .MockAddService (opts , tt .initialLB , nil )
1474
+ tt .fx .ActionClient .On ("WaitFor" , tt .fx .Ctx , action ).Return (nil )
1475
+
1476
+ opts = hcloud.LoadBalancerAddServiceOpts {
1477
+ Protocol : hcloud .LoadBalancerServiceProtocolTCP ,
1478
+ ListenPort : hcloud .Ptr (443 ),
1479
+ DestinationPort : hcloud .Ptr (8443 ),
1480
+ HealthCheck : & hcloud.LoadBalancerAddServiceOptsHealthCheck {
1481
+ Protocol : hcloud .LoadBalancerServiceProtocolTCP ,
1482
+ Port : hcloud .Ptr (8443 ),
1483
+ },
1484
+ }
1485
+ action = tt .fx .MockAddService (opts , tt .initialLB , nil )
1486
+ tt .fx .ActionClient .On ("WaitFor" , tt .fx .Ctx , action ).Return (nil )
1487
+ },
1488
+ perform : func (t * testing.T , tt * LBReconcilementTestCase ) {
1489
+ _ , err := tt .fx .LBOps .ReconcileHCLBServices (tt .fx .Ctx , tt .initialLB , tt .service )
1490
+ assert .NoError (t , err )
1491
+ },
1492
+ },
1451
1493
{
1452
1494
name : "add services to hc Load Balancer" ,
1453
1495
servicePorts : []corev1.ServicePort {
0 commit comments