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 b93d8eb commit ba1562f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/tests/ut/cp_network-attachments.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ setup_file () {

@test "Control Plane NetworkAttachmentDefinition: Global annotations and commonAnnotations can be added and are correctly merged" {
template \
--set-json 'interfaces=[{"type": "multus"}]' -\
-set 'global.annotations.foo=bar' \
--set-json 'interfaces=[{"type": "multus"}]' \
--set 'global.annotations.foo=bar' \
--set 'commonAnnotations.baz=baa'
assert_query_equal '.metadata.annotations.foo' "bar"
assert_query_equal '.metadata.annotations.baz' "baa"
Expand Down
41 changes: 41 additions & 0 deletions charts/tests/ut/cp_statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,52 @@ setup_file () {
}

@test "Control Plane StatefulSet: XR_INTERFACES container env vars is correctly set" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni"}]'
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"
}

@test "Control Plane StatefulSet: set snoopIpv4Address flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv4Address": 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"
}

@test "Control Plane StatefulSet: set snoopIpv4DefaultRoot flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv4DefaultRoot": 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"
}

@test "Control Plane StatefulSet: set snoopIpv6Address flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv6Address": 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"
}

@test "Control Plane StatefulSet: set snoopIpv6DefaultRoot flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "snoopIpv6DefaultRoot": 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"
}

@test "Control Plane StatefulSet: set chksum flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "chksum": 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,chksum"
}

@test "Control Plane StatefulSet: set xrName flag in XR_INTERFACES" {
template --set-json 'interfaces=[{"type": "multus"}, {"type": "defaultCni", "xrName": "foo"}]'
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,xr_name=foo"
}

@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"
}

@test "Control Plane StatefulSet: XR_MGMT_INTERFACES container env vars is correctly set" {
template --set-json 'mgmtInterfaces=[{"type": "multus", "chksum": true}, {"type": "defaultCni"}]'
assert_query_equal '.spec.template.spec.containers[0].env[2].name' "XR_MGMT_INTERFACES"
Expand Down

0 comments on commit ba1562f

Please sign in to comment.