test: TestNetworkIPAM_Equal
This commit is contained in:
parent
661ebf707e
commit
d3cbfe400a
7
main.go
Normal file
7
main.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "log"
|
||||
|
||||
func main() {
|
||||
log.Println("Hello World")
|
||||
}
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user