From f14afa7c4fc696e31c0823fcfedf74efd13b55a3 Mon Sep 17 00:00:00 2001 From: paulyufan2 Date: Mon, 19 Aug 2024 11:34:37 -0400 Subject: [PATCH] add ut for ShallowCopyIpamAddConfigOptions --- cni/network/invoker_cns_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cni/network/invoker_cns_test.go b/cni/network/invoker_cns_test.go index 8a75f645bed..8b35f11ef58 100644 --- a/cni/network/invoker_cns_test.go +++ b/cni/network/invoker_cns_test.go @@ -2094,3 +2094,20 @@ func TestCNSIPAMInvoker_Add_SwiftV2(t *testing.T) { }) } } + +func TestShallowCopyIpamAddConfigOptions(t *testing.T) { + opts := IPAMAddConfig{ + // mock all optios' fields + options: map[string]interface{}{ + network.SNATIPKey: "10", + dockerNetworkOption: "20", + "intType": 10, + "floatType": 0.51, + "byteType": byte('A'), + }, + } + + // shallow copy all ipamAddConfig options + res := opts.shallowCopyIpamAddConfigOptions() + require.Equal(t, opts.options, res) +}