From 358d6721602ae43ad4b78a9b7a49ec5cf8bc6940 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 25 Sep 2019 16:11:27 -0700 Subject: [PATCH] Add hostname CRI validation and unit test. Signed-off-by: Lantao Liu --- hack/utils.sh | 2 +- pkg/server/container_create_windows_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/utils.sh b/hack/utils.sh index 1bafa3a26..f143d9a2c 100755 --- a/hack/utils.sh +++ b/hack/utils.sh @@ -17,7 +17,7 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/.. # Not from vendor.conf. -CRITOOL_VERSION=ad1e8a4f1e0e44b22c1c371b9dc4db92eba6f157 +CRITOOL_VERSION=v1.16.1 CRITOOL_PKG=github.com/kubernetes-sigs/cri-tools CRITOOL_REPO=github.com/kubernetes-sigs/cri-tools diff --git a/pkg/server/container_create_windows_test.go b/pkg/server/container_create_windows_test.go index db2fa4c51..778f489dd 100644 --- a/pkg/server/container_create_windows_test.go +++ b/pkg/server/container_create_windows_test.go @@ -83,6 +83,7 @@ func getCreateContainerTestData() (*runtime.ContainerConfig, *runtime.PodSandbox Namespace: "test-sandbox-ns", Attempt: 2, }, + Hostname: "test-hostname", Annotations: map[string]string{"c": "d"}, } imageConfig := &imagespec.ImageConfig{ @@ -93,6 +94,7 @@ func getCreateContainerTestData() (*runtime.ContainerConfig, *runtime.PodSandbox } specCheck := func(t *testing.T, id string, sandboxID string, sandboxPid uint32, spec *runtimespec.Spec) { assert.Nil(t, spec.Root) + assert.Equal(t, "test-hostname", spec.Hostname) assert.Equal(t, []string{"test", "command", "test", "args"}, spec.Process.Args) assert.Equal(t, "test-cwd", spec.Process.Cwd) assert.Contains(t, spec.Process.Env, "k1=v1", "k2=v2", "k3=v3=v3bis", "ik4=iv4=iv4bis=boop")