diff --git a/pki/domain/dockerCompose/config_test.go b/pki/domain/dockerCompose/config_test.go index 3a01a2e..4782118 100644 --- a/pki/domain/dockerCompose/config_test.go +++ b/pki/domain/dockerCompose/config_test.go @@ -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) + } +}