Add e2e tests
This commit is contained in:
parent
99a355f25d
commit
601fb7dacf
1163 changed files with 289217 additions and 14195 deletions
3
vendor/k8s.io/kubernetes/pkg/api/validation/BUILD
generated
vendored
3
vendor/k8s.io/kubernetes/pkg/api/validation/BUILD
generated
vendored
|
|
@ -11,12 +11,12 @@ go_library(
|
|||
"events.go",
|
||||
"validation.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/api/validation",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/api:go_default_library",
|
||||
"//pkg/api/helper:go_default_library",
|
||||
"//pkg/api/service:go_default_library",
|
||||
"//pkg/api/util:go_default_library",
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/api/v1/helper:go_default_library",
|
||||
"//pkg/capabilities:go_default_library",
|
||||
|
|
@ -47,6 +47,7 @@ go_test(
|
|||
"events_test.go",
|
||||
"validation_test.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/api/validation",
|
||||
library = ":go_default_library",
|
||||
deps = [
|
||||
"//pkg/api:go_default_library",
|
||||
|
|
|
|||
11
vendor/k8s.io/kubernetes/pkg/api/validation/events.go
generated
vendored
11
vendor/k8s.io/kubernetes/pkg/api/validation/events.go
generated
vendored
|
|
@ -25,7 +25,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
apiutil "k8s.io/kubernetes/pkg/api/util"
|
||||
)
|
||||
|
||||
// ValidateEvent makes sure that the event makes sense.
|
||||
|
|
@ -63,12 +62,16 @@ func ValidateEvent(event *api.Event) field.ErrorList {
|
|||
|
||||
// Check whether the kind in groupVersion is scoped at the root of the api hierarchy
|
||||
func isNamespacedKind(kind, groupVersion string) (bool, error) {
|
||||
group := apiutil.GetGroup(groupVersion)
|
||||
g, err := api.Registry.Group(group)
|
||||
gv, err := schema.ParseGroupVersion(groupVersion)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
restMapping, err := g.RESTMapper.RESTMapping(schema.GroupKind{Group: group, Kind: kind}, apiutil.GetVersion(groupVersion))
|
||||
g, err := api.Registry.Group(gv.Group)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
restMapping, err := g.RESTMapper.RESTMapping(schema.GroupKind{Group: gv.Group, Kind: kind}, gv.Version)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
|||
14
vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go
generated
vendored
14
vendor/k8s.io/kubernetes/pkg/api/validation/validation_test.go
generated
vendored
|
|
@ -3059,12 +3059,12 @@ func TestValidatePorts(t *testing.T) {
|
|||
"invalid protocol case": {
|
||||
[]api.ContainerPort{{ContainerPort: 80, Protocol: "tcp"}},
|
||||
field.ErrorTypeNotSupported,
|
||||
"protocol", "supported values: TCP, UDP",
|
||||
"protocol", `supported values: "TCP", "UDP"`,
|
||||
},
|
||||
"invalid protocol": {
|
||||
[]api.ContainerPort{{ContainerPort: 80, Protocol: "ICMP"}},
|
||||
field.ErrorTypeNotSupported,
|
||||
"protocol", "supported values: TCP, UDP",
|
||||
"protocol", `supported values: "TCP", "UDP"`,
|
||||
},
|
||||
"protocol required": {
|
||||
[]api.ContainerPort{{Name: "abc", ContainerPort: 80}},
|
||||
|
|
@ -3426,7 +3426,7 @@ func TestValidateEnv(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}},
|
||||
expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: metadata.name, metadata.namespace, metadata.uid, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP`,
|
||||
expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP"`,
|
||||
},
|
||||
{
|
||||
name: "invalid fieldPath annotations",
|
||||
|
|
@ -3439,7 +3439,7 @@ func TestValidateEnv(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}},
|
||||
expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.annotations": supported values: metadata.name, metadata.namespace, metadata.uid, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP`,
|
||||
expectedError: `[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.annotations": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP"`,
|
||||
},
|
||||
{
|
||||
name: "unsupported fieldPath",
|
||||
|
|
@ -3452,7 +3452,7 @@ func TestValidateEnv(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}},
|
||||
expectedError: `valueFrom.fieldRef.fieldPath: Unsupported value: "status.phase": supported values: metadata.name, metadata.namespace, metadata.uid, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP`,
|
||||
expectedError: `valueFrom.fieldRef.fieldPath: Unsupported value: "status.phase": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP"`,
|
||||
},
|
||||
}
|
||||
for _, tc := range errorCases {
|
||||
|
|
@ -5036,7 +5036,7 @@ func TestValidatePod(t *testing.T) {
|
|||
Name: "pod-forgiveness-invalid",
|
||||
Namespace: "ns",
|
||||
},
|
||||
Spec: extendPodSpecwithTolerations(validPodSpec(nil), []api.Toleration{{Key: "node.alpha.kubernetes.io/notReady", Operator: "Exists", Effect: "NoExecute", TolerationSeconds: &[]int64{-2}[0]}}),
|
||||
Spec: extendPodSpecwithTolerations(validPodSpec(nil), []api.Toleration{{Key: "node.kubernetes.io/not-ready", Operator: "Exists", Effect: "NoExecute", TolerationSeconds: &[]int64{-2}[0]}}),
|
||||
},
|
||||
{ // docker default seccomp profile
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
@ -5594,7 +5594,7 @@ func TestValidatePod(t *testing.T) {
|
|||
Name: "pod-forgiveness-invalid",
|
||||
Namespace: "ns",
|
||||
},
|
||||
Spec: extendPodSpecwithTolerations(validPodSpec(nil), []api.Toleration{{Key: "node.alpha.kubernetes.io/notReady", Operator: "Exists", Effect: "NoSchedule", TolerationSeconds: &[]int64{20}[0]}}),
|
||||
Spec: extendPodSpecwithTolerations(validPodSpec(nil), []api.Toleration{{Key: "node.kubernetes.io/not-ready", Operator: "Exists", Effect: "NoSchedule", TolerationSeconds: &[]int64{20}[0]}}),
|
||||
},
|
||||
},
|
||||
"must be a valid pod seccomp profile": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue