test: TestNetworkIPAM_Equal

This commit is contained in:
Markus Pesch 2023-07-24 09:08:03 +02:00
parent 661ebf707e
commit d3cbfe400a
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 48 additions and 0 deletions

7
main.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "log"
func main() {
log.Println("Hello World")
}

View File

@ -75,6 +75,47 @@ func TestNetwork_Equal(t *testing.T) {
}
}
func TestNetworkIPAM_Equal(t *testing.T) {
require := require.New(t)
testCases := []struct {
equalableA dockerCompose.Equalable
equalableB dockerCompose.Equalable
expectedResult bool
}{
{
equalableA: &dockerCompose.NetworkIPAM{},
equalableB: &dockerCompose.Service{},
expectedResult: false,
},
{
equalableA: &dockerCompose.NetworkIPAM{},
equalableB: nil,
expectedResult: false,
},
{
equalableA: &dockerCompose.NetworkIPAM{
Configs: make([]*dockerCompose.NetworkIPAMConfig, 0),
},
equalableB: &dockerCompose.NetworkIPAM{},
expectedResult: false,
},
{
equalableA: &dockerCompose.NetworkIPAM{
Configs: make([]*dockerCompose.NetworkIPAMConfig, 0),
},
equalableB: &dockerCompose.NetworkIPAM{
Configs: make([]*dockerCompose.NetworkIPAMConfig, 0),
},
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)