rkt: Expand environment variables in Command and Args.

This commit is contained in:
Yifan Gu
2016-01-27 23:14:50 -08:00
parent eb2c2d1af4
commit dcee692d64
2 changed files with 11 additions and 9 deletions

View File

@@ -863,8 +863,8 @@ func TestSetApp(t *testing.T) {
// app should be changed. (env, mounts, ports, are overrided).
{
container: &api.Container{
Command: []string{"/bin/bar"},
Args: []string{"hello", "world"},
Command: []string{"/bin/bar", "$(env-foo)"},
Args: []string{"hello", "world", "$(env-bar)"},
WorkingDir: tmpDir,
Resources: api.ResourceRequirements{
Limits: api.ResourceList{"cpu": resource.MustParse("50m"), "memory": resource.MustParse("50M")},
@@ -874,6 +874,7 @@ func TestSetApp(t *testing.T) {
opts: &kubecontainer.RunContainerOptions{
Envs: []kubecontainer.EnvVar{
{Name: "env-foo", Value: "foo"},
{Name: "env-bar", Value: "bar"},
},
Mounts: []kubecontainer.Mount{
{Name: "mnt-foo", ContainerPath: "/mnt-bar", ReadOnly: true},
@@ -895,13 +896,14 @@ func TestSetApp(t *testing.T) {
FSGroup: &fsgid,
},
expect: &appctypes.App{
Exec: appctypes.Exec{"/bin/bar", "hello", "world"},
Exec: appctypes.Exec{"/bin/bar", "foo", "hello", "world", "bar"},
User: "42",
Group: "22",
SupplementaryGIDs: []int{1, 2, 3},
WorkingDirectory: tmpDir,
Environment: []appctypes.EnvironmentVariable{
{"env-foo", "foo"},
{"env-bar", "bar"},
},
MountPoints: []appctypes.MountPoint{
{Name: *appctypes.MustACName("mnt-foo"), Path: "/mnt-bar", ReadOnly: true},