mirror of https://github.com/docker/compose.git
Add unit tests for `PrepareVolumes`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
parent
c4d79e60b6
commit
43c444e890
|
@ -96,6 +96,44 @@ func TestPrepareNetworkLabels(t *testing.T) {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrepareVolumes(t *testing.T) {
|
||||||
|
t.Run("adds dependency condition if service depends on volume from another service", func(t *testing.T) {
|
||||||
|
project := composetypes.Project{
|
||||||
|
Name: "myProject",
|
||||||
|
Services: []composetypes.ServiceConfig{
|
||||||
|
{
|
||||||
|
Name: "aService",
|
||||||
|
VolumesFrom: []string{"anotherService"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "anotherService",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
prepareVolumes(&project)
|
||||||
|
assert.Equal(t, project.Services[0].DependsOn["anotherService"].Condition, composetypes.ServiceConditionStarted)
|
||||||
|
})
|
||||||
|
t.Run("doesn't overwrite existing dependency condition", func(t *testing.T) {
|
||||||
|
project := composetypes.Project{
|
||||||
|
Name: "myProject",
|
||||||
|
Services: []composetypes.ServiceConfig{
|
||||||
|
{
|
||||||
|
Name: "aService",
|
||||||
|
VolumesFrom: []string{"anotherService"},
|
||||||
|
DependsOn: map[string]composetypes.ServiceDependency{
|
||||||
|
"anotherService": {Condition: composetypes.ServiceConditionHealthy},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "anotherService",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
prepareVolumes(&project)
|
||||||
|
assert.Equal(t, project.Services[0].DependsOn["anotherService"].Condition, composetypes.ServiceConditionHealthy)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuildContainerMountOptions(t *testing.T) {
|
func TestBuildContainerMountOptions(t *testing.T) {
|
||||||
project := composetypes.Project{
|
project := composetypes.Project{
|
||||||
Name: "myProject",
|
Name: "myProject",
|
||||||
|
|
Loading…
Reference in New Issue