mirror of https://github.com/k3s-io/k3s
Remove unused code in UT files in pkg/
parent
5911f87dad
commit
fa8afc1d39
|
@ -1000,23 +1000,6 @@ func getBackendPort(port int32) int32 {
|
|||
return port + 10000
|
||||
}
|
||||
|
||||
func getTestPublicFipConfigurationProperties() network.FrontendIPConfigurationPropertiesFormat {
|
||||
return network.FrontendIPConfigurationPropertiesFormat{
|
||||
PublicIPAddress: &network.PublicIPAddress{ID: to.StringPtr("/this/is/a/public/ip/address/id")},
|
||||
}
|
||||
}
|
||||
|
||||
func getTestInternalFipConfigurationProperties(expectedSubnetName *string) network.FrontendIPConfigurationPropertiesFormat {
|
||||
var expectedSubnet *network.Subnet
|
||||
if expectedSubnetName != nil {
|
||||
expectedSubnet = &network.Subnet{Name: expectedSubnetName}
|
||||
}
|
||||
return network.FrontendIPConfigurationPropertiesFormat{
|
||||
PublicIPAddress: &network.PublicIPAddress{ID: to.StringPtr("/this/is/a/public/ip/address/id")},
|
||||
Subnet: expectedSubnet,
|
||||
}
|
||||
}
|
||||
|
||||
func getTestService(identifier string, proto v1.Protocol, requestedPorts ...int32) v1.Service {
|
||||
ports := []v1.ServicePort{}
|
||||
for _, port := range requestedPorts {
|
||||
|
@ -1056,39 +1039,6 @@ func setLoadBalancerAutoModeAnnotation(service *v1.Service) {
|
|||
setLoadBalancerModeAnnotation(service, ServiceAnnotationLoadBalancerAutoModeValue)
|
||||
}
|
||||
|
||||
func getTestLoadBalancer(services ...v1.Service) network.LoadBalancer {
|
||||
rules := []network.LoadBalancingRule{}
|
||||
probes := []network.Probe{}
|
||||
|
||||
for _, service := range services {
|
||||
for _, port := range service.Spec.Ports {
|
||||
ruleName := getLoadBalancerRuleName(&service, port, nil)
|
||||
rules = append(rules, network.LoadBalancingRule{
|
||||
Name: to.StringPtr(ruleName),
|
||||
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
|
||||
FrontendPort: to.Int32Ptr(port.Port),
|
||||
BackendPort: to.Int32Ptr(port.Port),
|
||||
},
|
||||
})
|
||||
probes = append(probes, network.Probe{
|
||||
Name: to.StringPtr(ruleName),
|
||||
ProbePropertiesFormat: &network.ProbePropertiesFormat{
|
||||
Port: to.Int32Ptr(port.NodePort),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
lb := network.LoadBalancer{
|
||||
LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{
|
||||
LoadBalancingRules: &rules,
|
||||
Probes: &probes,
|
||||
},
|
||||
}
|
||||
|
||||
return lb
|
||||
}
|
||||
|
||||
func getServiceSourceRanges(service *v1.Service) []string {
|
||||
if len(service.Spec.LoadBalancerSourceRanges) == 0 {
|
||||
if !requiresInternalLoadBalancer(service) {
|
||||
|
|
|
@ -207,7 +207,6 @@ go_test(
|
|||
importpath = "k8s.io/kubernetes/pkg/kubectl/cmd",
|
||||
deps = [
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/api/ref:go_default_library",
|
||||
"//pkg/api/testapi:go_default_library",
|
||||
"//pkg/api/testing:go_default_library",
|
||||
"//pkg/apis/batch:go_default_library",
|
||||
|
|
|
@ -286,9 +286,9 @@ func TestAttach(t *testing.T) {
|
|||
func TestAttachWarnings(t *testing.T) {
|
||||
version := legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion.Version
|
||||
tests := []struct {
|
||||
name, container, version, podPath, fetchPodPath, expectedErr, expectedOut string
|
||||
pod *api.Pod
|
||||
stdin, tty bool
|
||||
name, container, version, podPath, fetchPodPath, expectedErr string
|
||||
pod *api.Pod
|
||||
stdin, tty bool
|
||||
}{
|
||||
{
|
||||
name: "fallback tty if not supported",
|
||||
|
|
|
@ -44,7 +44,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/rest/fake"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/api/ref"
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/apis/batch"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
|
@ -882,18 +881,3 @@ func (m *MyReq) isFor(method string, path string) bool {
|
|||
req.URL.Path == strings.Join([]string{"/apis/extensions/v1beta1", path}, "") ||
|
||||
req.URL.Path == strings.Join([]string{"/apis/batch/v1", path}, ""))
|
||||
}
|
||||
|
||||
func refJson(t *testing.T, o runtime.Object) string {
|
||||
ref, err := ref.GetReference(legacyscheme.Scheme, o)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
_, _, codec, _ := cmdtesting.NewAPIFactory()
|
||||
json, err := runtime.Encode(codec, &api.SerializedReference{Reference: *ref})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
return string(json)
|
||||
}
|
||||
|
|
|
@ -163,9 +163,9 @@ func TestPodAndContainer(t *testing.T) {
|
|||
func TestExec(t *testing.T) {
|
||||
version := "v1"
|
||||
tests := []struct {
|
||||
name, podPath, execPath, container string
|
||||
pod *api.Pod
|
||||
execErr bool
|
||||
name, podPath, execPath string
|
||||
pod *api.Pod
|
||||
execErr bool
|
||||
}{
|
||||
{
|
||||
name: "pod exec",
|
||||
|
|
|
@ -34,8 +34,8 @@ import (
|
|||
|
||||
func TestLog(t *testing.T) {
|
||||
tests := []struct {
|
||||
name, version, podPath, logPath, container string
|
||||
pod *api.Pod
|
||||
name, version, podPath, logPath string
|
||||
pod *api.Pod
|
||||
}{
|
||||
{
|
||||
name: "v1 - pod log",
|
||||
|
|
|
@ -47,10 +47,10 @@ func testPortForward(t *testing.T, flags map[string]string, args []string) {
|
|||
version := "v1"
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
podPath, pfPath, container string
|
||||
pod *api.Pod
|
||||
pfErr bool
|
||||
name string
|
||||
podPath, pfPath string
|
||||
pod *api.Pod
|
||||
pfErr bool
|
||||
}{
|
||||
{
|
||||
name: "pod portforward",
|
||||
|
|
|
@ -83,17 +83,6 @@ func defaultClientConfig() *restclient.Config {
|
|||
}
|
||||
}
|
||||
|
||||
func defaultClientConfigForVersion(version *schema.GroupVersion) *restclient.Config {
|
||||
return &restclient.Config{
|
||||
APIPath: "/api",
|
||||
ContentConfig: restclient.ContentConfig{
|
||||
NegotiatedSerializer: scheme.Codecs,
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
GroupVersion: version,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type testPrinter struct {
|
||||
Objects []runtime.Object
|
||||
Err error
|
||||
|
|
|
@ -84,7 +84,6 @@ func TestTaint(t *testing.T) {
|
|||
args []string
|
||||
expectFatal bool
|
||||
expectTaint bool
|
||||
selector bool
|
||||
}{
|
||||
// success cases
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ func TestTopPod(t *testing.T) {
|
|||
testNS := "testns"
|
||||
testCases := []struct {
|
||||
name string
|
||||
namespace string
|
||||
flags map[string]string
|
||||
args []string
|
||||
expectedPath string
|
||||
|
@ -176,7 +175,6 @@ func TestTopPodCustomDefaults(t *testing.T) {
|
|||
testNS := "custom-namespace"
|
||||
testCases := []struct {
|
||||
name string
|
||||
namespace string
|
||||
flags map[string]string
|
||||
args []string
|
||||
expectedPath string
|
||||
|
|
|
@ -29,7 +29,6 @@ func TestNamespaceGenerate(t *testing.T) {
|
|||
params map[string]interface{}
|
||||
expected *v1.Namespace
|
||||
expectErr bool
|
||||
index int
|
||||
}{
|
||||
{
|
||||
params: map[string]interface{}{
|
||||
|
|
|
@ -1260,7 +1260,6 @@ func TestFindSourceController(t *testing.T) {
|
|||
tests := []struct {
|
||||
list *api.ReplicationControllerList
|
||||
expectedController *api.ReplicationController
|
||||
err error
|
||||
name string
|
||||
expectError bool
|
||||
}{
|
||||
|
|
|
@ -47,7 +47,6 @@ go_test(
|
|||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -28,7 +28,6 @@ import (
|
|||
"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/types"
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cm/cpumanager/state"
|
||||
|
@ -118,28 +117,6 @@ func (psp mockPodStatusProvider) GetPodStatus(uid types.UID) (v1.PodStatus, bool
|
|||
return psp.podStatus, psp.found
|
||||
}
|
||||
|
||||
type mockPodKiller struct {
|
||||
killedPods []*v1.Pod
|
||||
}
|
||||
|
||||
func (f *mockPodKiller) killPodNow(pod *v1.Pod, status v1.PodStatus, gracePeriodOverride *int64) error {
|
||||
f.killedPods = append(f.killedPods, pod)
|
||||
return nil
|
||||
}
|
||||
|
||||
type mockPodProvider struct {
|
||||
pods []*v1.Pod
|
||||
}
|
||||
|
||||
func (f *mockPodProvider) getPods() []*v1.Pod {
|
||||
return f.pods
|
||||
}
|
||||
|
||||
type mockRecorder struct{}
|
||||
|
||||
func (r *mockRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) {
|
||||
}
|
||||
|
||||
func makePod(cpuRequest, cpuLimit string) *v1.Pod {
|
||||
return &v1.Pod{
|
||||
Spec: v1.PodSpec{
|
||||
|
@ -161,20 +138,6 @@ func makePod(cpuRequest, cpuLimit string) *v1.Pod {
|
|||
}
|
||||
}
|
||||
|
||||
// CpuAllocatable must be <= CpuCapacity
|
||||
func prepareCPUNodeStatus(CPUCapacity, CPUAllocatable string) v1.NodeStatus {
|
||||
nodestatus := v1.NodeStatus{
|
||||
Capacity: make(v1.ResourceList, 1),
|
||||
Allocatable: make(v1.ResourceList, 1),
|
||||
}
|
||||
cpucap, _ := resource.ParseQuantity(CPUCapacity)
|
||||
cpuall, _ := resource.ParseQuantity(CPUAllocatable)
|
||||
|
||||
nodestatus.Capacity[v1.ResourceCPU] = cpucap
|
||||
nodestatus.Allocatable[v1.ResourceCPU] = cpuall
|
||||
return nodestatus
|
||||
}
|
||||
|
||||
func TestCPUManagerAdd(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
|
|
|
@ -233,11 +233,6 @@ func TestUpdateCapacityAllocatable(t *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
type stringPairType struct {
|
||||
value1 string
|
||||
value2 string
|
||||
}
|
||||
|
||||
func constructDevices(devices []string) sets.String {
|
||||
ret := sets.NewString()
|
||||
for _, dev := range devices {
|
||||
|
|
|
@ -1645,7 +1645,7 @@ func TestGetStarvedResources(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func testParsePercentage(t *testing.T) {
|
||||
func TestParsePercentage(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
hasError bool
|
||||
value float32
|
||||
|
@ -1674,7 +1674,7 @@ func testParsePercentage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func testCompareThresholdValue(t *testing.T) {
|
||||
func TestCompareThresholdValue(t *testing.T) {
|
||||
testCases := []struct {
|
||||
a, b evictionapi.ThresholdValue
|
||||
equal bool
|
||||
|
@ -1831,20 +1831,6 @@ func newResourceList(cpu, memory, disk string) v1.ResourceList {
|
|||
return res
|
||||
}
|
||||
|
||||
func newEphemeralStorageResourceList(ephemeral, cpu, memory string) v1.ResourceList {
|
||||
res := v1.ResourceList{}
|
||||
if ephemeral != "" {
|
||||
res[v1.ResourceEphemeralStorage] = resource.MustParse(ephemeral)
|
||||
}
|
||||
if cpu != "" {
|
||||
res[v1.ResourceCPU] = resource.MustParse(cpu)
|
||||
}
|
||||
if memory != "" {
|
||||
res[v1.ResourceMemory] = resource.MustParse("1Mi")
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func newResourceRequirements(requests, limits v1.ResourceList) v1.ResourceRequirements {
|
||||
res := v1.ResourceRequirements{}
|
||||
res.Requests = requests
|
||||
|
|
|
@ -334,8 +334,6 @@ func newTestPods(count int) []*v1.Pod {
|
|||
return pods
|
||||
}
|
||||
|
||||
var emptyPodUIDs map[types.UID]kubetypes.SyncPodType
|
||||
|
||||
func TestSyncLoopAbort(t *testing.T) {
|
||||
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
|
||||
defer testKubelet.Cleanup()
|
||||
|
|
|
@ -65,7 +65,6 @@ func TestSandboxGC(t *testing.T) {
|
|||
description string // description of the test case
|
||||
sandboxes []sandboxTemplate // templates of sandboxes
|
||||
containers []containerTemplate // templates of containers
|
||||
minAge time.Duration // sandboxMinGCAge
|
||||
remain []int // template indexes of remaining sandboxes
|
||||
evictTerminatedPods bool
|
||||
}{
|
||||
|
|
|
@ -225,12 +225,6 @@ func verifyFakeContainerList(fakeRuntime *apitest.FakeRuntimeService, expected s
|
|||
return actual, actual.Equal(expected)
|
||||
}
|
||||
|
||||
type containerRecord struct {
|
||||
container *v1.Container
|
||||
attempt uint32
|
||||
state runtimeapi.ContainerState
|
||||
}
|
||||
|
||||
// Only extract the fields of interests.
|
||||
type cRecord struct {
|
||||
name string
|
||||
|
|
|
@ -50,13 +50,6 @@ func createRemoteRuntimeService(endpoint string, t *testing.T) internalapi.Runti
|
|||
return runtimeService
|
||||
}
|
||||
|
||||
func createRemoteImageService(endpoint string, t *testing.T) internalapi.ImageManagerService {
|
||||
imageService, err := NewRemoteImageService(endpoint, defaultConnectionTimeout)
|
||||
assert.NoError(t, err)
|
||||
|
||||
return imageService
|
||||
}
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
fakeRuntime, endpoint := createAndStartFakeRemoteRuntime(t)
|
||||
defer fakeRuntime.Stop()
|
||||
|
|
|
@ -195,7 +195,6 @@ func (f *fakePodDeletionProvider) IsPodDeleted(uid types.UID) bool {
|
|||
|
||||
type fakeUnitGetter struct {
|
||||
networkNamespace kubecontainer.ContainerID
|
||||
callServices []string
|
||||
}
|
||||
|
||||
func newfakeUnitGetter() *fakeUnitGetter {
|
||||
|
|
|
@ -38,7 +38,6 @@ import (
|
|||
func TestCRIListPodStats(t *testing.T) {
|
||||
const (
|
||||
seedRoot = 0
|
||||
seedRuntime = 100
|
||||
seedKubelet = 200
|
||||
seedMisc = 300
|
||||
seedSandbox0 = 1000
|
||||
|
|
|
@ -59,7 +59,6 @@ const (
|
|||
offsetFsTotalUsageBytes
|
||||
offsetFsBaseUsageBytes
|
||||
offsetFsInodeUsage
|
||||
offsetVolume
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -145,13 +145,8 @@ go_test(
|
|||
"//vendor/github.com/go-openapi/strfmt:go_default_library",
|
||||
"//vendor/github.com/go-openapi/validate:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/k8s.io/api/apps/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/api/autoscaling/v1:go_default_library",
|
||||
"//vendor/k8s.io/api/batch/v1:go_default_library",
|
||||
"//vendor/k8s.io/api/batch/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/api/certificates/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
|
|
|
@ -27,13 +27,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
appsapiv1beta1 "k8s.io/api/apps/v1beta1"
|
||||
autoscalingapiv1 "k8s.io/api/autoscaling/v1"
|
||||
batchapiv1 "k8s.io/api/batch/v1"
|
||||
batchapiv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
certificatesapiv1beta1 "k8s.io/api/certificates/v1beta1"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
extensionsapiv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
@ -194,32 +189,6 @@ func newMaster(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *ass
|
|||
return master, etcdserver, config, assert
|
||||
}
|
||||
|
||||
// limitedAPIResourceConfigSource only enables the core group, the extensions group, the batch group, and the autoscaling group.
|
||||
func limitedAPIResourceConfigSource() *serverstorage.ResourceConfig {
|
||||
ret := serverstorage.NewResourceConfig()
|
||||
ret.EnableVersions(
|
||||
apiv1.SchemeGroupVersion,
|
||||
extensionsapiv1beta1.SchemeGroupVersion,
|
||||
batchapiv1.SchemeGroupVersion,
|
||||
batchapiv1beta1.SchemeGroupVersion,
|
||||
appsapiv1beta1.SchemeGroupVersion,
|
||||
autoscalingapiv1.SchemeGroupVersion,
|
||||
)
|
||||
return ret
|
||||
}
|
||||
|
||||
// newLimitedMaster only enables the core group, the extensions group, the batch group, and the autoscaling group.
|
||||
func newLimitedMaster(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *assert.Assertions) {
|
||||
etcdserver, config, sharedInformers, assert := setUp(t)
|
||||
config.ExtraConfig.APIResourceConfigSource = limitedAPIResourceConfigSource()
|
||||
master, err := config.Complete(sharedInformers).New(genericapiserver.EmptyDelegate)
|
||||
if err != nil {
|
||||
t.Fatalf("Error in bringing up the master: %v", err)
|
||||
}
|
||||
|
||||
return master, etcdserver, config, assert
|
||||
}
|
||||
|
||||
// TestVersion tests /version
|
||||
func TestVersion(t *testing.T) {
|
||||
s, etcdserver, _, _ := newMaster(t)
|
||||
|
|
|
@ -45,17 +45,6 @@ func testPrintNamespace(obj *api.Namespace, options PrintOptions) ([]metav1alpha
|
|||
return []metav1alpha1.TableRow{row}, nil
|
||||
}
|
||||
|
||||
func testPrintNamespaceList(list *api.NamespaceList, options PrintOptions) ([]metav1alpha1.TableRow, error) {
|
||||
rows := make([]metav1alpha1.TableRow, 0, len(list.Items))
|
||||
for i := range list.Items {
|
||||
r, err := testPrintNamespace(&list.Items[i], options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rows = append(rows, r...)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
func TestPrintRowsForHandlerEntry(t *testing.T) {
|
||||
printFunc := reflect.ValueOf(testPrintNamespace)
|
||||
|
||||
|
|
|
@ -783,8 +783,8 @@ func TestDefaultDescribers(t *testing.T) {
|
|||
|
||||
func TestGetPodsTotalRequests(t *testing.T) {
|
||||
testCases := []struct {
|
||||
pods *api.PodList
|
||||
expectedReqs, expectedLimits map[api.ResourceName]resource.Quantity
|
||||
pods *api.PodList
|
||||
expectedReqs map[api.ResourceName]resource.Quantity
|
||||
}{
|
||||
{
|
||||
pods: &api.PodList{
|
||||
|
|
|
@ -44,17 +44,6 @@ func newStorage(t *testing.T) (StatefulSetStorage, *etcdtesting.EtcdTestServer)
|
|||
return storage, server
|
||||
}
|
||||
|
||||
// createStatefulSet is a helper function that returns a StatefulSet with the updated resource version.
|
||||
func createStatefulSet(storage *REST, ps apps.StatefulSet, t *testing.T) (apps.StatefulSet, error) {
|
||||
ctx := genericapirequest.WithNamespace(genericapirequest.NewContext(), ps.Namespace)
|
||||
obj, err := storage.Create(ctx, &ps, rest.ValidateAllObjectFunc, false)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to create StatefulSet, %v", err)
|
||||
}
|
||||
newPS := obj.(*apps.StatefulSet)
|
||||
return *newPS, nil
|
||||
}
|
||||
|
||||
func validNewStatefulSet() *apps.StatefulSet {
|
||||
return &apps.StatefulSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
|
@ -26,12 +26,6 @@ import (
|
|||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
)
|
||||
|
||||
func newBool(a bool) *bool {
|
||||
r := new(bool)
|
||||
*r = a
|
||||
return r
|
||||
}
|
||||
|
||||
func TestCronJobStrategy(t *testing.T) {
|
||||
ctx := genericapirequest.NewDefaultContext()
|
||||
if !Strategy.NamespaceScoped() {
|
||||
|
|
|
@ -54,16 +54,6 @@ func validNewEndpoints() *api.Endpoints {
|
|||
}
|
||||
}
|
||||
|
||||
func validChangedEndpoints() *api.Endpoints {
|
||||
endpoints := validNewEndpoints()
|
||||
endpoints.ResourceVersion = "1"
|
||||
endpoints.Subsets = []api.EndpointSubset{{
|
||||
Addresses: []api.EndpointAddress{{IP: "1.2.3.4"}, {IP: "5.6.7.8"}},
|
||||
Ports: []api.EndpointPort{{Port: 80, Protocol: "TCP"}},
|
||||
}}
|
||||
return endpoints
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
storage, server := newStorage(t)
|
||||
defer server.Terminate(t)
|
||||
|
|
|
@ -31,19 +31,6 @@ import (
|
|||
_ "k8s.io/kubernetes/pkg/api/testapi"
|
||||
)
|
||||
|
||||
func testEvent(name string) *api.Event {
|
||||
return &api.Event{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: "default",
|
||||
},
|
||||
InvolvedObject: api.ObjectReference{
|
||||
Namespace: "default",
|
||||
},
|
||||
Reason: "forTesting",
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAttrs(t *testing.T) {
|
||||
eventA := &api.Event{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
|
@ -77,11 +77,6 @@ func validNewPersistentVolume(name string) *api.PersistentVolume {
|
|||
return pv
|
||||
}
|
||||
|
||||
func validChangedPersistentVolume() *api.PersistentVolume {
|
||||
pv := validNewPersistentVolume("foo")
|
||||
return pv
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
storage, _, server := newStorage(t)
|
||||
defer server.Terminate(t)
|
||||
|
|
|
@ -138,11 +138,6 @@ func getResourceList(cpu, memory string) api.ResourceList {
|
|||
return res
|
||||
}
|
||||
|
||||
func addResource(rName, value string, rl api.ResourceList) api.ResourceList {
|
||||
rl[api.ResourceName(rName)] = resource.MustParse(value)
|
||||
return rl
|
||||
}
|
||||
|
||||
func getResourceRequirements(requests, limits api.ResourceList) api.ResourceRequirements {
|
||||
res := api.ResourceRequirements{}
|
||||
res.Requests = requests
|
||||
|
|
|
@ -74,17 +74,6 @@ var validController = api.ReplicationController{
|
|||
Spec: validControllerSpec,
|
||||
}
|
||||
|
||||
var validScale = autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test"},
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: validReplicas,
|
||||
},
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: 0,
|
||||
Selector: "a=b",
|
||||
},
|
||||
}
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
storage, _, si, destroyFunc := newStorage(t)
|
||||
defer destroyFunc()
|
||||
|
|
|
@ -39,17 +39,6 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer)
|
|||
return podDisruptionBudgetStorage, statusStorage, server
|
||||
}
|
||||
|
||||
// createPodDisruptionBudget is a helper function that returns a PodDisruptionBudget with the updated resource version.
|
||||
func createPodDisruptionBudget(storage *REST, pdb policy.PodDisruptionBudget, t *testing.T) (policy.PodDisruptionBudget, error) {
|
||||
ctx := genericapirequest.WithNamespace(genericapirequest.NewContext(), pdb.Namespace)
|
||||
obj, err := storage.Create(ctx, &pdb, rest.ValidateAllObjectFunc, false)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to create PodDisruptionBudget, %v", err)
|
||||
}
|
||||
newPS := obj.(*policy.PodDisruptionBudget)
|
||||
return *newPS, nil
|
||||
}
|
||||
|
||||
func validNewPodDisruptionBudget() *policy.PodDisruptionBudget {
|
||||
minAvailable := intstr.FromInt(7)
|
||||
return &policy.PodDisruptionBudget{
|
||||
|
|
|
@ -57,10 +57,6 @@ func validNewStorageClass(name string) *storageapi.StorageClass {
|
|||
}
|
||||
}
|
||||
|
||||
func validChangedStorageClass() *storageapi.StorageClass {
|
||||
return validNewStorageClass("foo")
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
storage, server := newStorage(t)
|
||||
defer server.Terminate(t)
|
||||
|
|
|
@ -60,10 +60,6 @@ func validNewVolumeAttachment(name string) *storageapi.VolumeAttachment {
|
|||
}
|
||||
}
|
||||
|
||||
func validChangedVolumeAttachment() *storageapi.VolumeAttachment {
|
||||
return validNewVolumeAttachment("foo")
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
if *testapi.Storage.GroupVersion() != storageapiv1alpha1.SchemeGroupVersion {
|
||||
// skip the test for all versions exception v1alpha1
|
||||
|
|
|
@ -31,10 +31,7 @@ go_test(
|
|||
],
|
||||
embed = [":go_default_library"],
|
||||
importpath = "k8s.io/kubernetes/pkg/security/podsecuritypolicy/group",
|
||||
deps = [
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
],
|
||||
deps = ["//pkg/apis/extensions:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package group
|
||||
|
||||
import (
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"testing"
|
||||
)
|
||||
|
@ -110,7 +109,6 @@ func TestGenerate(t *testing.T) {
|
|||
func TestValidate(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
ranges []extensions.GroupIDRange
|
||||
pod *api.Pod
|
||||
groups []int64
|
||||
pass bool
|
||||
}{
|
||||
|
|
|
@ -80,17 +80,6 @@ X024wzbiw1q07jFCyfQmODzURAx1VNT7QVUMdz/N8vy47/H40AZJ
|
|||
-----END RSA PRIVATE KEY-----
|
||||
`
|
||||
|
||||
// openssl ecparam -name prime256v1 -genkey -out ecdsa256params.pem
|
||||
const ecdsaPrivateKeyWithParams = `-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIJ9LWDj3ZWe9CksPV7mZjD2dYXG9icfzxadCRwd3vr1toAoGCCqGSM49
|
||||
AwEHoUQDQgAEaLNEpzbaaNTCkKjBVj7sxpfJ1ifJQGNvcck4nrzcwFRuujwVDDJh
|
||||
95iIGwKCQeSg+yhdN6Q/p2XaxNIZlYmUhg==
|
||||
-----END EC PRIVATE KEY-----
|
||||
`
|
||||
|
||||
// openssl ecparam -name prime256v1 -genkey -noout -out ecdsa256.pem
|
||||
const ecdsaPrivateKey = `-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIEZmTmUhuanLjPA2CLquXivuwBDHTt5XYwgIr/kA1LtRoAoGCCqGSM49
|
||||
|
|
|
@ -25,21 +25,16 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
DBusNameFlagAllowReplacement uint32 = 1 << (iota + 1)
|
||||
DBusNameFlagReplaceExisting
|
||||
DBusNameFlagDoNotQueue
|
||||
DBusNameFlagDoNotQueue uint32 = 1 << (iota + 1)
|
||||
)
|
||||
|
||||
const (
|
||||
DBusRequestNameReplyPrimaryOwner uint32 = iota + 1
|
||||
DBusRequestNameReplyInQueue
|
||||
DBusRequestNameReplyExists
|
||||
DBusRequestNameReplyAlreadyOwner
|
||||
)
|
||||
|
||||
const (
|
||||
DBusReleaseNameReplyReleased uint32 = iota + 1
|
||||
DBusReleaseNameReplyNonExistent
|
||||
DBusReleaseNameReplyNotOwner
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue