mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 14:29:45 +00:00
manually fix unit tests in pkg/api/v1
more manually fix pkg/api/v1 unit tests change ImportPrefix manually fix pkg/api unit tests
This commit is contained in:
@@ -17,14 +17,13 @@ limitations under the License.
|
||||
package v1_test
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/testing/compat"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/kubernetes/pkg/api/validation"
|
||||
|
||||
_ "k8s.io/kubernetes/pkg/api/install"
|
||||
|
@@ -17,19 +17,19 @@ limitations under the License.
|
||||
package v1_test
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/api/core/v1"
|
||||
k8s_api_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
func TestPodLogOptions(t *testing.T) {
|
||||
@@ -39,7 +39,7 @@ func TestPodLogOptions(t *testing.T) {
|
||||
limitBytes := int64(3)
|
||||
|
||||
versionedLogOptions := &v1.PodLogOptions{
|
||||
v1.Container: "mycontainer",
|
||||
Container: "mycontainer",
|
||||
Follow: true,
|
||||
Previous: true,
|
||||
SinceSeconds: &sinceSeconds,
|
||||
@@ -49,7 +49,7 @@ func TestPodLogOptions(t *testing.T) {
|
||||
LimitBytes: &limitBytes,
|
||||
}
|
||||
unversionedLogOptions := &api.PodLogOptions{
|
||||
v1.Container: "mycontainer",
|
||||
Container: "mycontainer",
|
||||
Follow: true,
|
||||
Previous: true,
|
||||
SinceSeconds: &sinceSeconds,
|
||||
@@ -211,7 +211,7 @@ func TestResourceListConversion(t *testing.T) {
|
||||
|
||||
// defaulting is a separate step from conversion that is applied when reading from the API or from etcd.
|
||||
// perform that step explicitly.
|
||||
v1.SetDefaults_ResourceList(&test.input)
|
||||
k8s_api_v1.SetDefaults_ResourceList(&test.input)
|
||||
|
||||
err := api.Scheme.Convert(&test.input, &output, nil)
|
||||
if err != nil {
|
||||
|
@@ -17,17 +17,17 @@ limitations under the License.
|
||||
package v1_test
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/api/core/v1"
|
||||
k8s_api_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
||||
@@ -61,7 +61,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
rc: &v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -74,14 +74,14 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
},
|
||||
{
|
||||
rc: &v1.ReplicationController{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"bar": "foo",
|
||||
},
|
||||
},
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -94,7 +94,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
},
|
||||
{
|
||||
rc: &v1.ReplicationController{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"bar": "foo",
|
||||
},
|
||||
@@ -104,7 +104,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
"some": "other",
|
||||
},
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -122,7 +122,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
"some": "other",
|
||||
},
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -175,7 +175,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -190,7 +190,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(0),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -205,7 +205,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -460,7 +460,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
{
|
||||
Ports: []v1.ContainerPort{
|
||||
{
|
||||
Name: "default",
|
||||
Name: "default",
|
||||
v1.Protocol: v1.ProtocolTCP,
|
||||
},
|
||||
},
|
||||
@@ -473,7 +473,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": `
|
||||
[
|
||||
@@ -518,7 +518,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": `
|
||||
[
|
||||
@@ -676,8 +676,8 @@ func TestSetDefaultSecretVolumeSource(t *testing.T) {
|
||||
s := v1.PodSpec{}
|
||||
s.Volumes = []v1.Volume{
|
||||
{
|
||||
v1.VolumeSource: v1.VolumeSource{
|
||||
v1.Secret: &v1.SecretVolumeSource{},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
Secret: &v1.SecretVolumeSource{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -698,8 +698,8 @@ func TestSetDefaultConfigMapVolumeSource(t *testing.T) {
|
||||
s := v1.PodSpec{}
|
||||
s.Volumes = []v1.Volume{
|
||||
{
|
||||
v1.VolumeSource: v1.VolumeSource{
|
||||
v1.ConfigMap: &v1.ConfigMapVolumeSource{},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
ConfigMap: &v1.ConfigMapVolumeSource{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -720,7 +720,7 @@ func TestSetDefaultDownwardAPIVolumeSource(t *testing.T) {
|
||||
s := v1.PodSpec{}
|
||||
s.Volumes = []v1.Volume{
|
||||
{
|
||||
v1.VolumeSource: v1.VolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
DownwardAPI: &v1.DownwardAPIVolumeSource{},
|
||||
},
|
||||
},
|
||||
@@ -742,7 +742,7 @@ func TestSetDefaultProjectedVolumeSource(t *testing.T) {
|
||||
s := v1.PodSpec{}
|
||||
s.Volumes = []v1.Volume{
|
||||
{
|
||||
v1.VolumeSource: v1.VolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
Projected: &v1.ProjectedVolumeSource{},
|
||||
},
|
||||
},
|
||||
@@ -928,7 +928,7 @@ func TestSetDefaultPodSpecHostNetwork(t *testing.T) {
|
||||
{
|
||||
Ports: []v1.ContainerPort{
|
||||
{
|
||||
v1.ContainerPort: portNum,
|
||||
ContainerPort: portNum,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -937,7 +937,7 @@ func TestSetDefaultPodSpecHostNetwork(t *testing.T) {
|
||||
{
|
||||
Ports: []v1.ContainerPort{
|
||||
{
|
||||
v1.ContainerPort: portNum,
|
||||
ContainerPort: portNum,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1105,7 +1105,7 @@ func TestSetMinimumScalePod(t *testing.T) {
|
||||
pod := &v1.Pod{
|
||||
Spec: s,
|
||||
}
|
||||
v1.SetObjectDefaults_Pod(pod)
|
||||
k8s_api_v1.SetObjectDefaults_Pod(pod)
|
||||
|
||||
if expect := resource.MustParse("1m"); expect.Cmp(pod.Spec.Containers[0].Resources.Requests[v1.ResourceMemory]) != 0 {
|
||||
t.Errorf("did not round resources: %#v", pod.Spec.Containers[0].Resources)
|
||||
@@ -1198,7 +1198,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@@ -1218,7 +1218,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
|
||||
func TestSetDefaultLimitRangeItem(t *testing.T) {
|
||||
limitRange := &v1.LimitRange{
|
||||
v1.ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-defaults",
|
||||
},
|
||||
Spec: v1.LimitRangeSpec{
|
||||
|
Reference in New Issue
Block a user