Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebeaty-cisco committed Mar 19, 2024
1 parent ba1562f commit 89dc9b6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
6 changes: 3 additions & 3 deletions charts/tests/ut/cp_statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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"
}
Expand All @@ -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" {
Expand Down
41 changes: 41 additions & 0 deletions charts/tests/ut/vrouter_statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 89dc9b6

Please sign in to comment.