test: TestNetworkIPAMConfig_Equal

This commit is contained in:
Markus Pesch 2023-07-24 09:10:06 +02:00
parent d3cbfe400a
commit 0d91cdcc6f
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -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)