Skip to content

Commit

Permalink
add ut for ShallowCopyIpamAddConfigOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Aug 19, 2024
1 parent 65d80a1 commit f14afa7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cni/network/invoker_cns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit f14afa7

Please sign in to comment.