diff --git a/pkg/api/errors/BUILD b/pkg/api/errors/BUILD deleted file mode 100644 index 32cc80a037..0000000000 --- a/pkg/api/errors/BUILD +++ /dev/null @@ -1,54 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "errors.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/util/validation/field", - ], -) - -go_test( - name = "go_default_test", - srcs = ["errors_test.go"], - library = ":go_default_library", - tags = ["automanaged"], - deps = [ - "//pkg/api:go_default_library", - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/util/validation/field", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [ - ":package-srcs", - "//pkg/api/errors/storage:all-srcs", - ], - tags = ["automanaged"], -) diff --git a/pkg/api/errors/doc.go b/pkg/api/errors/doc.go index 0929d746c2..87434414bb 100644 --- a/pkg/api/errors/doc.go +++ b/pkg/api/errors/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors. +Copyright 2016 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. @@ -14,5 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package errors provides detailed error types for api field validation. -package errors // import "k8s.io/kubernetes/pkg/api/errors" +// Package errors is for verify-godeps.sh and is temporary +// TODO apimachinery remove this empty package. Godep fails without this because heapster relies +// on this package. This will allow us to start splitting packages, but will force +// heapster to update on their next kube rebase. +package errors diff --git a/pkg/api/errors/OWNERS b/staging/src/k8s.io/apimachinery/pkg/api/errors/OWNERS similarity index 100% rename from pkg/api/errors/OWNERS rename to staging/src/k8s.io/apimachinery/pkg/api/errors/OWNERS diff --git a/staging/src/k8s.io/apimachinery/pkg/api/errors/doc.go b/staging/src/k8s.io/apimachinery/pkg/api/errors/doc.go new file mode 100644 index 0000000000..0929d746c2 --- /dev/null +++ b/staging/src/k8s.io/apimachinery/pkg/api/errors/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2014 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 errors provides detailed error types for api field validation. +package errors // import "k8s.io/kubernetes/pkg/api/errors" diff --git a/pkg/api/errors/errors.go b/staging/src/k8s.io/apimachinery/pkg/api/errors/errors.go similarity index 100% rename from pkg/api/errors/errors.go rename to staging/src/k8s.io/apimachinery/pkg/api/errors/errors.go diff --git a/pkg/api/errors/errors_test.go b/staging/src/k8s.io/apimachinery/pkg/api/errors/errors_test.go similarity index 85% rename from pkg/api/errors/errors_test.go rename to staging/src/k8s.io/apimachinery/pkg/api/errors/errors_test.go index 932afa85ec..c488d2d24c 100644 --- a/pkg/api/errors/errors_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/errors/errors_test.go @@ -26,11 +26,17 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/kubernetes/pkg/api" ) +func resource(resource string) schema.GroupResource { + return schema.GroupResource{Group: "", Resource: resource} +} +func kind(kind string) schema.GroupKind { + return schema.GroupKind{Group: "", Kind: kind} +} + func TestErrorNew(t *testing.T) { - err := NewAlreadyExists(api.Resource("tests"), "1") + err := NewAlreadyExists(resource("tests"), "1") if !IsAlreadyExists(err) { t.Errorf("expected to be %s", metav1.StatusReasonAlreadyExists) } @@ -56,34 +62,34 @@ func TestErrorNew(t *testing.T) { t.Errorf("expected to not be %s", metav1.StatusReasonMethodNotAllowed) } - if !IsConflict(NewConflict(api.Resource("tests"), "2", errors.New("message"))) { + if !IsConflict(NewConflict(resource("tests"), "2", errors.New("message"))) { t.Errorf("expected to be conflict") } - if !IsNotFound(NewNotFound(api.Resource("tests"), "3")) { + if !IsNotFound(NewNotFound(resource("tests"), "3")) { t.Errorf("expected to be %s", metav1.StatusReasonNotFound) } - if !IsInvalid(NewInvalid(api.Kind("Test"), "2", nil)) { + if !IsInvalid(NewInvalid(kind("Test"), "2", nil)) { t.Errorf("expected to be %s", metav1.StatusReasonInvalid) } if !IsBadRequest(NewBadRequest("reason")) { t.Errorf("expected to be %s", metav1.StatusReasonBadRequest) } - if !IsForbidden(NewForbidden(api.Resource("tests"), "2", errors.New("reason"))) { + if !IsForbidden(NewForbidden(resource("tests"), "2", errors.New("reason"))) { t.Errorf("expected to be %s", metav1.StatusReasonForbidden) } if !IsUnauthorized(NewUnauthorized("reason")) { t.Errorf("expected to be %s", metav1.StatusReasonUnauthorized) } - if !IsServerTimeout(NewServerTimeout(api.Resource("tests"), "reason", 0)) { + if !IsServerTimeout(NewServerTimeout(resource("tests"), "reason", 0)) { t.Errorf("expected to be %s", metav1.StatusReasonServerTimeout) } - if time, ok := SuggestsClientDelay(NewServerTimeout(api.Resource("tests"), "doing something", 10)); time != 10 || !ok { + if time, ok := SuggestsClientDelay(NewServerTimeout(resource("tests"), "doing something", 10)); time != 10 || !ok { t.Errorf("expected to be %s", metav1.StatusReasonServerTimeout) } if time, ok := SuggestsClientDelay(NewTimeoutError("test reason", 10)); time != 10 || !ok { t.Errorf("expected to be %s", metav1.StatusReasonTimeout) } - if !IsMethodNotSupported(NewMethodNotSupported(api.Resource("foos"), "delete")) { + if !IsMethodNotSupported(NewMethodNotSupported(resource("foos"), "delete")) { t.Errorf("expected to be %s", metav1.StatusReasonMethodNotAllowed) } } @@ -152,7 +158,7 @@ func TestNewInvalid(t *testing.T) { for i, testCase := range testCases { vErr, expected := testCase.Err, testCase.Details expected.Causes[0].Message = vErr.ErrorBody() - err := NewInvalid(api.Kind("Kind"), "name", field.ErrorList{vErr}) + err := NewInvalid(kind("Kind"), "name", field.ErrorList{vErr}) status := err.ErrStatus if status.Code != 422 || status.Reason != metav1.StatusReasonInvalid { t.Errorf("%d: unexpected status: %#v", i, status)