Merge pull request #1530 from danielkrainas/set-envs-v2-spec

set envs when converting to v2 spec
This commit is contained in:
David Ashpole 2017-04-10 21:31:27 -07:00 committed by GitHub
commit 94db83f31b
2 changed files with 4 additions and 0 deletions

View File

@ -259,6 +259,7 @@ func ContainerSpecFromV1(specV1 *v1.ContainerSpec, aliases []string, namespace s
HasCustomMetrics: specV1.HasCustomMetrics,
Image: specV1.Image,
Labels: specV1.Labels,
Envs: specV1.Envs,
}
if specV1.HasCpu {
specV2.Cpu.Limit = specV1.Cpu.Limit

View File

@ -26,12 +26,14 @@ import (
var (
timestamp = time.Date(1987, time.August, 10, 0, 0, 0, 0, time.UTC)
labels = map[string]string{"foo": "bar"}
envs = map[string]string{"foo": "bar"}
)
func TestContanierSpecFromV1(t *testing.T) {
v1Spec := v1.ContainerSpec{
CreationTime: timestamp,
Labels: labels,
Envs: envs,
HasCpu: true,
Cpu: v1.CpuSpec{
Limit: 2048,
@ -63,6 +65,7 @@ func TestContanierSpecFromV1(t *testing.T) {
expectedV2Spec := ContainerSpec{
CreationTime: timestamp,
Labels: labels,
Envs: envs,
HasCpu: true,
Cpu: CpuSpec{
Limit: 2048,