diff --git a/hack/.linted_packages b/hack/.linted_packages index 4bbe2bac59523..ccb15e48eb0d7 100644 --- a/hack/.linted_packages +++ b/hack/.linted_packages @@ -68,7 +68,6 @@ pkg/api/annotations pkg/api/errors pkg/api/events pkg/api/install -pkg/api/meta pkg/api/resource pkg/api/service pkg/api/v1 @@ -90,7 +89,6 @@ pkg/apis/componentconfig/install pkg/apis/extensions/install pkg/apis/extensions/v1beta1 pkg/apis/imagepolicy/install -pkg/apis/meta/v1/unstructured pkg/apis/policy/install pkg/apis/rbac/install pkg/apis/rbac/v1alpha1 @@ -239,7 +237,6 @@ pkg/registry/thirdpartyresource pkg/registry/thirdpartyresource/etcd pkg/runtime pkg/runtime/serializer/json -pkg/runtime/serializer/protobuf pkg/runtime/serializer/recognizer/testing pkg/runtime/serializer/versioning pkg/runtime/serializer/yaml diff --git a/pkg/api/meta/BUILD b/pkg/api/meta/BUILD index 26863be1dd030..b1c0a21e45178 100644 --- a/pkg/api/meta/BUILD +++ b/pkg/api/meta/BUILD @@ -51,30 +51,6 @@ go_test( ], ) -go_test( - name = "go_default_xtest", - srcs = [ - "help_test.go", - "meta_test.go", - "scheme_test.go", - ], - tags = ["automanaged"], - deps = [ - "//pkg/api:go_default_library", - "//pkg/api/meta:go_default_library", - "//pkg/api/testapi:go_default_library", - "//pkg/api/v1:go_default_library", - "//pkg/apis/meta/v1:go_default_library", - "//pkg/apis/meta/v1/unstructured:go_default_library", - "//pkg/runtime:go_default_library", - "//pkg/runtime/schema:go_default_library", - "//pkg/types:go_default_library", - "//pkg/util/diff:go_default_library", - "//pkg/util/sets:go_default_library", - "//vendor:github.com/google/gofuzz", - ], -) - filegroup( name = "package-srcs", srcs = glob(["**"]), diff --git a/pkg/apimachinery/BUILD b/pkg/apimachinery/BUILD index 2cbd2eaa6531f..643c3ddc01e2d 100644 --- a/pkg/apimachinery/BUILD +++ b/pkg/apimachinery/BUILD @@ -43,6 +43,7 @@ filegroup( ":package-srcs", "//pkg/apimachinery/announced:all-srcs", "//pkg/apimachinery/registered:all-srcs", + "//pkg/apimachinery/tests:all-srcs", ], tags = ["automanaged"], ) diff --git a/pkg/apimachinery/tests/BUILD b/pkg/apimachinery/tests/BUILD new file mode 100644 index 0000000000000..00b263f3f077f --- /dev/null +++ b/pkg/apimachinery/tests/BUILD @@ -0,0 +1,65 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", + "go_test", +) + +go_test( + name = "go_default_test", + srcs = [ + "api_meta_help_test.go", + "api_meta_meta_test.go", + "api_meta_scheme_test.go", + "apis_meta_v1_unstructed_unstructure_test.go", + "runtime_helper_test.go", + "runtime_serializer_protobuf_protobuf_test.go", + "runtime_unversioned_test.go", + "watch_until_test.go", + ], + library = ":go_default_library", + tags = ["automanaged"], + deps = [ + "//pkg/api:go_default_library", + "//pkg/api/install:go_default_library", + "//pkg/api/meta:go_default_library", + "//pkg/api/testapi:go_default_library", + "//pkg/api/v1:go_default_library", + "//pkg/api/validation:go_default_library", + "//pkg/apimachinery/registered:go_default_library", + "//pkg/apis/extensions:go_default_library", + "//pkg/apis/meta/v1:go_default_library", + "//pkg/apis/meta/v1/unstructured:go_default_library", + "//pkg/runtime:go_default_library", + "//pkg/runtime/schema:go_default_library", + "//pkg/runtime/serializer/protobuf:go_default_library", + "//pkg/types:go_default_library", + "//pkg/util/diff:go_default_library", + "//pkg/util/sets:go_default_library", + "//pkg/util/wait:go_default_library", + "//pkg/watch:go_default_library", + "//vendor:github.com/google/gofuzz", + ], +) + +go_library( + name = "go_default_library", + srcs = ["doc.go"], + tags = ["automanaged"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) diff --git a/pkg/api/meta/help_test.go b/pkg/apimachinery/tests/api_meta_help_test.go similarity index 99% rename from pkg/api/meta/help_test.go rename to pkg/apimachinery/tests/api_meta_help_test.go index 0a8b107cca11f..1a68b9248fb06 100644 --- a/pkg/api/meta/help_test.go +++ b/pkg/apimachinery/tests/api_meta_help_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package meta_test +package tests import ( "reflect" diff --git a/pkg/api/meta/meta_test.go b/pkg/apimachinery/tests/api_meta_meta_test.go similarity index 99% rename from pkg/api/meta/meta_test.go rename to pkg/apimachinery/tests/api_meta_meta_test.go index 4a90dd4267618..817d11b5c3fa0 100644 --- a/pkg/api/meta/meta_test.go +++ b/pkg/apimachinery/tests/api_meta_meta_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package meta_test +package tests import ( "reflect" diff --git a/pkg/api/meta/scheme_test.go b/pkg/apimachinery/tests/api_meta_scheme_test.go similarity index 99% rename from pkg/api/meta/scheme_test.go rename to pkg/apimachinery/tests/api_meta_scheme_test.go index 85813d4f25fbe..4c9e60442ca32 100644 --- a/pkg/api/meta/scheme_test.go +++ b/pkg/apimachinery/tests/api_meta_scheme_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package meta_test +package tests import ( "fmt" diff --git a/pkg/apis/meta/v1/unstructured/unstructured_test.go b/pkg/apimachinery/tests/apis_meta_v1_unstructed_unstructure_test.go similarity index 99% rename from pkg/apis/meta/v1/unstructured/unstructured_test.go rename to pkg/apimachinery/tests/apis_meta_v1_unstructed_unstructure_test.go index 272e80ad0f95e..7d9fd7f3bdd63 100644 --- a/pkg/apis/meta/v1/unstructured/unstructured_test.go +++ b/pkg/apimachinery/tests/apis_meta_v1_unstructed_unstructure_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package unstructured_test +package tests import ( "fmt" diff --git a/pkg/apimachinery/tests/doc.go b/pkg/apimachinery/tests/doc.go new file mode 100644 index 0000000000000..8d5b45029cb94 --- /dev/null +++ b/pkg/apimachinery/tests/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 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. +*/ + +// This package runs tests against the apimachinery which require a Scheme +// TODO Refactor the base types into the machinery and move these tests back. +// See https://github.com/kubernetes/kubernetes/issues/39611 +package tests diff --git a/pkg/runtime/helper_test.go b/pkg/apimachinery/tests/runtime_helper_test.go similarity index 98% rename from pkg/runtime/helper_test.go rename to pkg/apimachinery/tests/runtime_helper_test.go index 8c6dc8da861ee..b2250283bd6f2 100644 --- a/pkg/runtime/helper_test.go +++ b/pkg/apimachinery/tests/runtime_helper_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package runtime_test +package tests import ( "testing" diff --git a/pkg/runtime/serializer/protobuf/protobuf_test.go b/pkg/apimachinery/tests/runtime_serializer_protobuf_protobuf_test.go similarity index 99% rename from pkg/runtime/serializer/protobuf/protobuf_test.go rename to pkg/apimachinery/tests/runtime_serializer_protobuf_protobuf_test.go index b9c1a81019963..ca061eff5d17a 100644 --- a/pkg/runtime/serializer/protobuf/protobuf_test.go +++ b/pkg/apimachinery/tests/runtime_serializer_protobuf_protobuf_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package protobuf_test +package tests import ( "bytes" @@ -190,7 +190,7 @@ func TestEncode(t *testing.T) { } } -func TestDecode(t *testing.T) { +func TestProtobufDecode(t *testing.T) { wire1 := []byte{ 0x6b, 0x38, 0x73, 0x00, // prefix 0x0a, 0x04, diff --git a/pkg/runtime/unversioned_test.go b/pkg/apimachinery/tests/runtime_unversioned_test.go similarity index 99% rename from pkg/runtime/unversioned_test.go rename to pkg/apimachinery/tests/runtime_unversioned_test.go index fd837b0994968..3589263277df5 100644 --- a/pkg/runtime/unversioned_test.go +++ b/pkg/apimachinery/tests/runtime_unversioned_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package runtime_test +package tests import ( "encoding/json" diff --git a/pkg/watch/until_test.go b/pkg/apimachinery/tests/watch_until_test.go similarity index 99% rename from pkg/watch/until_test.go rename to pkg/apimachinery/tests/watch_until_test.go index 2cfee6bda06b8..e73f7fb43c2ed 100644 --- a/pkg/watch/until_test.go +++ b/pkg/apimachinery/tests/watch_until_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package watch_test +package tests import ( "errors" diff --git a/pkg/apis/meta/v1/unstructured/BUILD b/pkg/apis/meta/v1/unstructured/BUILD index e3c31947ac509..c6f2a2d966e6b 100644 --- a/pkg/apis/meta/v1/unstructured/BUILD +++ b/pkg/apis/meta/v1/unstructured/BUILD @@ -5,7 +5,6 @@ licenses(["notice"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", - "go_test", ) go_library( @@ -22,22 +21,6 @@ go_library( ], ) -go_test( - name = "go_default_xtest", - srcs = ["unstructured_test.go"], - tags = ["automanaged"], - deps = [ - "//pkg/api:go_default_library", - "//pkg/api/testapi:go_default_library", - "//pkg/api/validation:go_default_library", - "//pkg/apimachinery/registered:go_default_library", - "//pkg/apis/meta/v1:go_default_library", - "//pkg/apis/meta/v1/unstructured:go_default_library", - "//pkg/runtime:go_default_library", - "//pkg/types:go_default_library", - ], -) - filegroup( name = "package-srcs", srcs = glob(["**"]), diff --git a/pkg/runtime/BUILD b/pkg/runtime/BUILD index 524af031ee4a7..f02faefa98f65 100644 --- a/pkg/runtime/BUILD +++ b/pkg/runtime/BUILD @@ -52,18 +52,11 @@ go_test( "conversion_test.go", "embedded_test.go", "extension_test.go", - "helper_test.go", "scheme_test.go", - "unversioned_test.go", ], tags = ["automanaged"], deps = [ - "//pkg/api:go_default_library", "//pkg/api/meta:go_default_library", - "//pkg/api/testapi:go_default_library", - "//pkg/apimachinery/registered:go_default_library", - "//pkg/apis/extensions:go_default_library", - "//pkg/apis/meta/v1:go_default_library", "//pkg/conversion:go_default_library", "//pkg/runtime:go_default_library", "//pkg/runtime/schema:go_default_library", diff --git a/pkg/runtime/serializer/protobuf/BUILD b/pkg/runtime/serializer/protobuf/BUILD index 7795f05d2f44a..ba3ebbe8a8c14 100644 --- a/pkg/runtime/serializer/protobuf/BUILD +++ b/pkg/runtime/serializer/protobuf/BUILD @@ -5,7 +5,6 @@ licenses(["notice"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", - "go_test", ) go_library( @@ -24,21 +23,6 @@ go_library( ], ) -go_test( - name = "go_default_xtest", - srcs = ["protobuf_test.go"], - tags = ["automanaged"], - deps = [ - "//pkg/api:go_default_library", - "//pkg/api/install:go_default_library", - "//pkg/api/v1:go_default_library", - "//pkg/runtime:go_default_library", - "//pkg/runtime/schema:go_default_library", - "//pkg/runtime/serializer/protobuf:go_default_library", - "//pkg/util/diff:go_default_library", - ], -) - filegroup( name = "package-srcs", srcs = glob(["**"]), diff --git a/pkg/watch/BUILD b/pkg/watch/BUILD index ff6f1a8255440..ac329ce764563 100644 --- a/pkg/watch/BUILD +++ b/pkg/watch/BUILD @@ -35,12 +35,10 @@ go_test( "filter_test.go", "mux_test.go", "streamwatcher_test.go", - "until_test.go", "watch_test.go", ], tags = ["automanaged"], deps = [ - "//pkg/api:go_default_library", "//pkg/runtime:go_default_library", "//pkg/runtime/schema:go_default_library", "//pkg/util/wait:go_default_library",