test: TestVolume_MergeLastWin
This commit is contained in:
parent
e09f91feea
commit
e8b3d3bb13
@ -919,3 +919,46 @@ func TestVolume_Equal(t *testing.T) {
|
||||
require.Equal(testCase.expectedResult, testCase.equalableA.Equal(testCase.equalableB), "Failed test case %v", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVolume_MergeLastWin(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
testCases := []struct {
|
||||
volumeA *dockerCompose.Volume
|
||||
volumeB *dockerCompose.Volume
|
||||
expectedVolume *dockerCompose.Volume
|
||||
}{
|
||||
{
|
||||
volumeA: &dockerCompose.Volume{},
|
||||
volumeB: nil,
|
||||
expectedVolume: &dockerCompose.Volume{},
|
||||
},
|
||||
{
|
||||
volumeA: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
volumeB: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
expectedVolume: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
volumeA: &dockerCompose.Volume{
|
||||
External: true,
|
||||
},
|
||||
volumeB: &dockerCompose.Volume{
|
||||
External: false,
|
||||
},
|
||||
expectedVolume: &dockerCompose.Volume{
|
||||
External: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
testCase.volumeA.MergeLastWin(testCase.volumeB)
|
||||
require.Equal(testCase.expectedVolume, testCase.volumeA, "Failed test case %v", i)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user