mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
add test for flipServiceInternalAnnotation
This commit is contained in:
parent
1b9b3fd7c7
commit
839e7f4c38
@ -40,6 +40,30 @@ import (
|
|||||||
|
|
||||||
var testClusterName = "testCluster"
|
var testClusterName = "testCluster"
|
||||||
|
|
||||||
|
// Test flipServiceInternalAnnotation
|
||||||
|
func TestFlipServiceInternalAnnotation(t *testing.T) {
|
||||||
|
svc := getTestService("servicea", v1.ProtocolTCP, 80)
|
||||||
|
svcUpdated := flipServiceInternalAnnotation(&svc)
|
||||||
|
if !requiresInternalLoadBalancer(svcUpdated) {
|
||||||
|
t.Errorf("Expected svc to be an internal service")
|
||||||
|
}
|
||||||
|
svcUpdated = flipServiceInternalAnnotation(svcUpdated)
|
||||||
|
if requiresInternalLoadBalancer(svcUpdated) {
|
||||||
|
t.Errorf("Expected svc to be an external service")
|
||||||
|
}
|
||||||
|
|
||||||
|
svc2 := getInternalTestService("serviceb", 8081)
|
||||||
|
svc2Updated := flipServiceInternalAnnotation(&svc2)
|
||||||
|
if requiresInternalLoadBalancer(svc2Updated) {
|
||||||
|
t.Errorf("Expected svc to be an external service")
|
||||||
|
}
|
||||||
|
|
||||||
|
svc2Updated = flipServiceInternalAnnotation(svc2Updated)
|
||||||
|
if !requiresInternalLoadBalancer(svc2Updated) {
|
||||||
|
t.Errorf("Expected svc to be an internal service")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Test additional of a new service/port.
|
// Test additional of a new service/port.
|
||||||
func TestAddPort(t *testing.T) {
|
func TestAddPort(t *testing.T) {
|
||||||
az := getTestCloud()
|
az := getTestCloud()
|
||||||
|
Loading…
Reference in New Issue
Block a user