From 0ac49d77a0b92f246f0de5fa937a45aac545f23d Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 26 Feb 2015 22:20:34 -0500 Subject: [PATCH] TCPSocket could not be used as it was not checked in validation Attempting to use it gave the error "must register one handler". Added more tests for it. --- pkg/api/validation/validation_test.go | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/pkg/api/validation/validation_test.go b/pkg/api/validation/validation_test.go index 2635f7c63f7..fdda8adb9c7 100644 --- a/pkg/api/validation/validation_test.go +++ b/pkg/api/validation/validation_test.go @@ -496,6 +496,32 @@ func TestValidateContainers(t *testing.T) { ImagePullPolicy: "IfNotPresent", }, }, + "invalid lifecycle, no tcp socket port.": { + { + Name: "life-123", + Image: "image", + Lifecycle: &api.Lifecycle{ + PreStop: &api.Handler{ + TCPSocket: &api.TCPSocketAction{}, + }, + }, + ImagePullPolicy: "IfNotPresent", + }, + }, + "invalid lifecycle, zero tcp socket port.": { + { + Name: "life-123", + Image: "image", + Lifecycle: &api.Lifecycle{ + PreStop: &api.Handler{ + TCPSocket: &api.TCPSocketAction{ + Port: util.IntOrString{IntVal: 0}, + }, + }, + }, + ImagePullPolicy: "IfNotPresent", + }, + }, "invalid lifecycle, no action.": { { Name: "life-123", @@ -506,6 +532,28 @@ func TestValidateContainers(t *testing.T) { ImagePullPolicy: "IfNotPresent", }, }, + "invalid liveness probe, no tcp socket port.": { + { + Name: "life-123", + Image: "image", + LivenessProbe: &api.Probe{ + Handler: api.Handler{ + TCPSocket: &api.TCPSocketAction{}, + }, + }, + ImagePullPolicy: "IfNotPresent", + }, + }, + "invalid liveness probe, no action.": { + { + Name: "life-123", + Image: "image", + LivenessProbe: &api.Probe{ + Handler: api.Handler{}, + }, + ImagePullPolicy: "IfNotPresent", + }, + }, "privilege disabled": { {Name: "abc", Image: "image", Privileged: true}, },