diff --git a/pkg/api/testing/BUILD b/pkg/api/testing/BUILD index cf7b178e2e1..edfc62144df 100644 --- a/pkg/api/testing/BUILD +++ b/pkg/api/testing/BUILD @@ -13,7 +13,6 @@ go_library( "doc.go", "fuzzer.go", "install.go", - "pod_specs.go", ], importpath = "k8s.io/kubernetes/pkg/api/testing", deps = [ diff --git a/pkg/api/testing/pod_specs.go b/pkg/api/testing/pod_specs.go deleted file mode 100644 index 688788dcefd..00000000000 --- a/pkg/api/testing/pod_specs.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "k8s.io/api/core/v1" - api "k8s.io/kubernetes/pkg/apis/core" -) - -// DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual -func DeepEqualSafePodSpec() api.PodSpec { - grace := int64(30) - return api.PodSpec{ - RestartPolicy: api.RestartPolicyAlways, - DNSPolicy: api.DNSClusterFirst, - TerminationGracePeriodSeconds: &grace, - SecurityContext: &api.PodSecurityContext{}, - SchedulerName: api.DefaultSchedulerName, - } -} - -// V1DeepEqualSafePodSpec returns a PodSpec which is ready to be used with apiequality.Semantic.DeepEqual -func V1DeepEqualSafePodSpec() v1.PodSpec { - grace := int64(30) - return v1.PodSpec{ - RestartPolicy: v1.RestartPolicyAlways, - DNSPolicy: v1.DNSClusterFirst, - TerminationGracePeriodSeconds: &grace, - SecurityContext: &v1.PodSecurityContext{}, - } -} diff --git a/pkg/scheduler/BUILD b/pkg/scheduler/BUILD index baf11c614e8..c4b927fb580 100644 --- a/pkg/scheduler/BUILD +++ b/pkg/scheduler/BUILD @@ -60,7 +60,6 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//pkg/api/testing:go_default_library", "//pkg/apis/core:go_default_library", "//pkg/controller/volume/scheduling:go_default_library", "//pkg/features:go_default_library", diff --git a/pkg/scheduler/factory_test.go b/pkg/scheduler/factory_test.go index cd1eb70c0f0..2354ffdd43d 100644 --- a/pkg/scheduler/factory_test.go +++ b/pkg/scheduler/factory_test.go @@ -20,8 +20,6 @@ import ( "context" "encoding/json" "errors" - apierrors "k8s.io/apimachinery/pkg/api/errors" - apicore "k8s.io/kubernetes/pkg/apis/core" "reflect" "strings" "testing" @@ -29,6 +27,7 @@ import ( "github.com/google/go-cmp/cmp" v1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/clock" @@ -40,7 +39,7 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/events" extenderv1 "k8s.io/kube-scheduler/extender/v1" - apitesting "k8s.io/kubernetes/pkg/api/testing" + apicore "k8s.io/kubernetes/pkg/apis/core" kubefeatures "k8s.io/kubernetes/pkg/features" schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config" "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme" @@ -314,9 +313,15 @@ func TestCreateFromConfigWithUnspecifiedPredicatesOrPriorities(t *testing.T) { } func TestDefaultErrorFunc(t *testing.T) { + grace := int64(30) testPod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"}, - Spec: apitesting.V1DeepEqualSafePodSpec(), + Spec: v1.PodSpec{ + RestartPolicy: v1.RestartPolicyAlways, + DNSPolicy: v1.DNSClusterFirst, + TerminationGracePeriodSeconds: &grace, + SecurityContext: &v1.PodSecurityContext{}, + }, } nodeBar, nodeFoo :=