зеркало из https://github.com/microsoft/docker.git
add VolumesFrom to MergeConfig, and test
This commit is contained in:
Родитель
7c00201222
Коммит
1a226f0e28
3
utils.go
3
utils.go
|
@ -132,6 +132,9 @@ func MergeConfig(userConf, imageConf *Config) {
|
|||
if userConf.Entrypoint == nil || len(userConf.Entrypoint) == 0 {
|
||||
userConf.Entrypoint = imageConf.Entrypoint
|
||||
}
|
||||
if userConf.VolumesFrom == "" {
|
||||
userConf.VolumesFrom = imageConf.VolumesFrom
|
||||
}
|
||||
if userConf.Volumes == nil || len(userConf.Volumes) == 0 {
|
||||
userConf.Volumes = imageConf.Volumes
|
||||
} else {
|
||||
|
|
|
@ -191,10 +191,11 @@ func TestMergeConfig(t *testing.T) {
|
|||
volumesImage["/test1"] = struct{}{}
|
||||
volumesImage["/test2"] = struct{}{}
|
||||
configImage := &Config{
|
||||
Dns: []string{"1.1.1.1", "2.2.2.2"},
|
||||
PortSpecs: []string{"1111:1111", "2222:2222"},
|
||||
Env: []string{"VAR1=1", "VAR2=2"},
|
||||
Volumes: volumesImage,
|
||||
Dns: []string{"1.1.1.1", "2.2.2.2"},
|
||||
PortSpecs: []string{"1111:1111", "2222:2222"},
|
||||
Env: []string{"VAR1=1", "VAR2=2"},
|
||||
VolumesFrom: "1111",
|
||||
Volumes: volumesImage,
|
||||
}
|
||||
|
||||
volumesUser := make(map[string]struct{})
|
||||
|
@ -242,4 +243,8 @@ func TestMergeConfig(t *testing.T) {
|
|||
t.Fatalf("Expected /test1 or /test2 or /test3, found %s", v)
|
||||
}
|
||||
}
|
||||
|
||||
if configUser.VolumesFrom != "1111" {
|
||||
t.Fatalf("Expected VolumesFrom to be 1111, found %s", configUser.VolumesFrom)
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче