diff --git a/charts/tests/ut/cp_statefulset.bats b/charts/tests/ut/cp_statefulset.bats index 9aaca6f4..6a4af21d 100644 --- a/charts/tests/ut/cp_statefulset.bats +++ b/charts/tests/ut/cp_statefulset.bats @@ -334,7 +334,7 @@ setup_file () { } @test "Control Plane StatefulSet: set snoopIpv4DefaultRoot flag in XR_INTERFACES" { - template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv4DefaultRoot": true}]' + template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv4DefaultRoute": true}]' assert_query_equal '.spec.template.spec.containers[0].env[1].name' "XR_INTERFACES" assert_query_equal '.spec.template.spec.containers[0].env[1].value' "linux:net1;linux:eth0,snoop_v4_default_route" } @@ -346,7 +346,7 @@ setup_file () { } @test "Control Plane StatefulSet: set snoopIpv6DefaultRoot flag in XR_INTERFACES" { - template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv6DefaultRoot": true}]' + template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv6DefaultRoute": true}]' assert_query_equal '.spec.template.spec.containers[0].env[1].name' "XR_INTERFACES" assert_query_equal '.spec.template.spec.containers[0].env[1].value' "linux:net1;linux:eth0,snoop_v6_default_route" } @@ -365,7 +365,7 @@ setup_file () { @test "Control Plane StatefulSet: don't set unsupported flags XR_INTERFACES" { template_failure --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "foo": "bar"}]' - assert_error_message_contains "abcd" + assert_error_message_contains "Additional property foo is not allowed" } @test "Control Plane StatefulSet: XR_MGMT_INTERFACES container env vars is correctly set" { diff --git a/charts/tests/ut/vrouter_statefulset.bats b/charts/tests/ut/vrouter_statefulset.bats index e6c7203f..b4672bce 100644 --- a/charts/tests/ut/vrouter_statefulset.bats +++ b/charts/tests/ut/vrouter_statefulset.bats @@ -365,11 +365,52 @@ setup_file () { } @test "vRouter StatefulSet: XR_MGMT_INTERFACES container env vars is correctly set" { + template --set-json 'mgmtInterfaces=[{"type": "multus"}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1" +} + +@test "Control Plane StatefulSet: set snoopIpv4Address flag in XR_MGMT_INTERFACES" { + template --set-json 'mgmtInterfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv4Address": true}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,snoop_v4" +} + +@test "Control Plane StatefulSet: set snoopIpv4DefaultRoot flag in XR_MGMT_INTERFACES" { + template --set-json 'mgmtInterfaces=[{"type": "multus", "snoopIpv4DefaultRoute": true}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,snoop_v4_default_route" +} + +@test "Control Plane StatefulSet: set snoopIpv6Address flag in XR_MGMT_INTERFACES" { + template --set-json 'mgmtInterfaces=[{"type": "multus", "snoopIpv6Address": true}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,snoop_v6" +} + +@test "Control Plane StatefulSet: set snoopIpv6DefaultRoot flag in XR_MGMT_INTERFACES" { + template --set-json 'mgmtInterfaces=[{"type": "multus", "snoopIpv6DefaultRoute": true}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,snoop_v6_default_route" +} + +@test "Control Plane StatefulSet: set chksum flag in XR_MGMT_INTERFACES" { template --set-json 'mgmtInterfaces=[{"type": "multus", "chksum": true}]' assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,chksum" } +@test "Control Plane StatefulSet: set xrName flag in XR_MGMT_INTERFACES" { + template --set-json 'mgmtInterfaces=[{"type": "multus", "xrName": "foo"}]' + assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES" + assert_query_equal '.spec.template.spec.containers[0].env[2].value' "linux:net1,xr_name=foo" +} + +@test "Control Plane StatefulSet: don't set unsupported flags XR_MGMT_INTERFACES" { + template_failure --set-json 'mgmtInterfaces=[{"type": "multus", "foo": "bar"}]' + assert_error_message_contains "Additional property foo is not allowed" +} + @test "vRouter StatefulSet: XR_DISK_USAGE_LIMIT is set if persistence is enabled with default value" { template --set 'persistence.enabled=true' assert_query_equal '.spec.template.spec.containers[0].env[0].name' "XR_DISK_USAGE_LIMIT"