test: TestNetworkIPAMConfig_Equal
This commit is contained in:
parent
d3cbfe400a
commit
0d91cdcc6f
@ -116,6 +116,47 @@ func TestNetworkIPAM_Equal(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNetworkIPAM_Config(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
testCases := []struct {
|
||||
equalableA dockerCompose.Equalable
|
||||
equalableB dockerCompose.Equalable
|
||||
expectedResult bool
|
||||
}{
|
||||
{
|
||||
equalableA: &dockerCompose.NetworkIPAMConfig{},
|
||||
equalableB: &dockerCompose.Service{},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.NetworkIPAMConfig{},
|
||||
equalableB: nil,
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.NetworkIPAMConfig{
|
||||
Subnet: "10.12.13.14/15",
|
||||
},
|
||||
equalableB: &dockerCompose.NetworkIPAMConfig{},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.NetworkIPAMConfig{
|
||||
Subnet: "10.12.13.14/15",
|
||||
},
|
||||
equalableB: &dockerCompose.NetworkIPAMConfig{
|
||||
Subnet: "10.12.13.14/15",
|
||||
},
|
||||
expectedResult: true,
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
require.Equal(testCase.expectedResult, testCase.equalableA.Equal(testCase.equalableB), "Failed test case %v", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceDeployResourcesLimits_Equal(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user