manually fix unit tests
This commit is contained in:
@@ -364,7 +364,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": `
|
||||
[
|
||||
@@ -390,7 +390,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": `
|
||||
[
|
||||
@@ -437,7 +437,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": `
|
||||
[
|
||||
@@ -460,8 +460,8 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
{
|
||||
Ports: []v1.ContainerPort{
|
||||
{
|
||||
Name: "default",
|
||||
v1.Protocol: v1.ProtocolTCP,
|
||||
Name: "default",
|
||||
Protocol: v1.ProtocolTCP,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -545,7 +545,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
expected: []v1.Container{
|
||||
{
|
||||
LivenessProbe: &v1.Probe{
|
||||
v1.Handler: v1.Handler{
|
||||
Handler: v1.Handler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
@@ -557,7 +557,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
FailureThreshold: 3,
|
||||
},
|
||||
ReadinessProbe: &v1.Probe{
|
||||
v1.Handler: v1.Handler{
|
||||
Handler: v1.Handler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
@@ -577,7 +577,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": `
|
||||
[
|
||||
@@ -605,7 +605,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
},
|
||||
expected: []v1.Container{
|
||||
{
|
||||
v1.Lifecycle: &v1.Lifecycle{
|
||||
Lifecycle: &v1.Lifecycle{
|
||||
PostStart: &v1.Handler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
@@ -899,7 +899,7 @@ func TestSetDefaulServiceExternalTraffic(t *testing.T) {
|
||||
|
||||
in = &v1.Service{
|
||||
Spec: v1.ServiceSpec{Type: v1.ServiceTypeLoadBalancer},
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{v1.BetaAnnotationExternalTraffic: v1.AnnotationValueExternalTrafficLocal},
|
||||
},
|
||||
}
|
||||
|
@@ -19,11 +19,12 @@ package qos
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/helper/qos"
|
||||
"k8s.io/api/core/v1"
|
||||
k8sv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
func TestGetPodQOS(t *testing.T) {
|
||||
@@ -137,7 +138,7 @@ func TestGetPodQOS(t *testing.T) {
|
||||
|
||||
// Convert v1.Pod to api.Pod, and then check against `api.helper.GetPodQOS`.
|
||||
pod := api.Pod{}
|
||||
v1.Convert_v1_Pod_To_api_Pod(testCase.pod, &pod, nil)
|
||||
k8sv1.Convert_v1_Pod_To_api_Pod(testCase.pod, &pod, nil)
|
||||
|
||||
if actual := qos.GetPodQOS(&pod); api.PodQOSClass(testCase.expected) != actual {
|
||||
t.Errorf("[%d]: invalid qos pod %s, expected: %s, actual: %s", id, testCase.pod.Name, testCase.expected, actual)
|
||||
|
Reference in New Issue
Block a user