test: volume
This commit is contained in:
parent
70f33eb0df
commit
db9f0c5e52
@ -316,3 +316,51 @@ func TestServiceULimitsNoFile_Equal(t *testing.T) {
|
||||
require.Equal(testCase.expectedResult, testCase.equalableA.Equal(testCase.equalableB), "Failed test case %v", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVolume_Equal(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
testCases := []struct {
|
||||
equalableA dockerCompose.Equalable
|
||||
equalableB dockerCompose.Equalable
|
||||
expectedResult bool
|
||||
}{
|
||||
{
|
||||
equalableA: &dockerCompose.Volume{},
|
||||
equalableB: &dockerCompose.NetworkIPAM{},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.Volume{},
|
||||
equalableB: nil,
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: dockerCompose.NewVolume(),
|
||||
equalableB: dockerCompose.NewVolume(),
|
||||
expectedResult: true,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
equalableB: &dockerCompose.Volume{
|
||||
External: false,
|
||||
},
|
||||
expectedResult: false,
|
||||
},
|
||||
{
|
||||
equalableA: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
equalableB: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
expectedResult: true,
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
require.Equal(testCase.expectedResult, testCase.equalableA.Equal(testCase.equalableB), "Failed test case %v", i)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user