Merge pull request #84617 from seans3/testdata-move

Rename test/data directory to testdata
This commit is contained in:
Kubernetes Prow Robot 2019-11-01 00:57:23 -07:00 committed by GitHub
commit 868cbd119b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 77 additions and 78 deletions

View File

@ -25,7 +25,7 @@ filegroup(
"//staging/src/k8s.io/kubectl/pkg/scheme:all-srcs", "//staging/src/k8s.io/kubectl/pkg/scheme:all-srcs",
"//staging/src/k8s.io/kubectl/pkg/util:all-srcs", "//staging/src/k8s.io/kubectl/pkg/util:all-srcs",
"//staging/src/k8s.io/kubectl/pkg/validation:all-srcs", "//staging/src/k8s.io/kubectl/pkg/validation:all-srcs",
"//staging/src/k8s.io/kubectl/test/data:all-srcs", "//staging/src/k8s.io/kubectl/testdata:all-srcs",
], ],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],

View File

@ -33,7 +33,7 @@ go_test(
], ],
data = [ data = [
"test_swagger.json", "test_swagger.json",
"//staging/src/k8s.io/kubectl/test/data", "//staging/src/k8s.io/kubectl/testdata",
], ],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [

View File

@ -37,7 +37,7 @@ const (
noConflict = false noConflict = false
) )
var fakeResources = tst.NewFakeResources(filepath.Join("..", "..", "..", "test", "data", "openapi", "swagger.json")) var fakeResources = tst.NewFakeResources(filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json"))
// run parses the openapi and runs the tests // run parses the openapi and runs the tests
func run(instance apply.Strategy, recorded, local, remote, expected map[string]interface{}) { func run(instance apply.Strategy, recorded, local, remote, expected map[string]interface{}) {

View File

@ -29,7 +29,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["annotate_test.go"], srcs = ["annotate_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@ -543,7 +543,7 @@ func TestAnnotateObjectFromFile(t *testing.T) {
cmd := NewCmdAnnotate("kubectl", tf, iostreams) cmd := NewCmdAnnotate("kubectl", tf, iostreams)
cmd.SetOutput(bufOut) cmd.SetOutput(bufOut)
options := NewAnnotateOptions(iostreams) options := NewAnnotateOptions(iostreams)
options.Filenames = []string{"../../../test/data/controller.yaml"} options.Filenames = []string{"../../../testdata/controller.yaml"}
args := []string{"a=b", "c-"} args := []string{"a=b", "c-"}
if err := options.Complete(tf, cmd, args); err != nil { if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
@ -574,7 +574,7 @@ func TestAnnotateLocal(t *testing.T) {
cmd := NewCmdAnnotate("kubectl", tf, iostreams) cmd := NewCmdAnnotate("kubectl", tf, iostreams)
options := NewAnnotateOptions(iostreams) options := NewAnnotateOptions(iostreams)
options.local = true options.local = true
options.Filenames = []string{"../../../test/data/controller.yaml"} options.Filenames = []string{"../../../testdata/controller.yaml"}
args := []string{"a=b"} args := []string{"a=b"}
if err := options.Complete(tf, cmd, args); err != nil { if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)

View File

@ -50,7 +50,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["apply_test.go"], srcs = ["apply_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library",

View File

@ -54,7 +54,7 @@ import (
) )
var ( var (
fakeSchema = sptest.Fake{Path: filepath.Join("..", "..", "..", "test", "data", "openapi", "swagger.json")} fakeSchema = sptest.Fake{Path: filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json")}
testingOpenAPISchemaFns = []func() (openapi.Resources, error){nil, AlwaysErrorOpenAPISchemaFn, openAPISchemaFn} testingOpenAPISchemaFns = []func() (openapi.Resources, error){nil, AlwaysErrorOpenAPISchemaFn, openAPISchemaFn}
AlwaysErrorOpenAPISchemaFn = func() (openapi.Resources, error) { AlwaysErrorOpenAPISchemaFn = func() (openapi.Resources, error) {
return nil, errors.New("cannot get openapi spec") return nil, errors.New("cannot get openapi spec")
@ -87,23 +87,23 @@ func validateApplyArgs(cmd *cobra.Command, args []string) error {
} }
const ( const (
filenameCM = "../../../test/data/apply/cm.yaml" filenameCM = "../../../testdata/apply/cm.yaml"
filenameRC = "../../../test/data/apply/rc.yaml" filenameRC = "../../../testdata/apply/rc.yaml"
filenameRCArgs = "../../../test/data/apply/rc-args.yaml" filenameRCArgs = "../../../testdata/apply/rc-args.yaml"
filenameRCLastAppliedArgs = "../../../test/data/apply/rc-lastapplied-args.yaml" filenameRCLastAppliedArgs = "../../../testdata/apply/rc-lastapplied-args.yaml"
filenameRCNoAnnotation = "../../../test/data/apply/rc-no-annotation.yaml" filenameRCNoAnnotation = "../../../testdata/apply/rc-no-annotation.yaml"
filenameRCLASTAPPLIED = "../../../test/data/apply/rc-lastapplied.yaml" filenameRCLASTAPPLIED = "../../../testdata/apply/rc-lastapplied.yaml"
filenameSVC = "../../../test/data/apply/service.yaml" filenameSVC = "../../../testdata/apply/service.yaml"
filenameRCSVC = "../../../test/data/apply/rc-service.yaml" filenameRCSVC = "../../../testdata/apply/rc-service.yaml"
filenameNoExistRC = "../../../test/data/apply/rc-noexist.yaml" filenameNoExistRC = "../../../testdata/apply/rc-noexist.yaml"
filenameRCPatchTest = "../../../test/data/apply/patch.json" filenameRCPatchTest = "../../../testdata/apply/patch.json"
dirName = "../../../test/data/apply/testdir" dirName = "../../../testdata/apply/testdir"
filenameRCJSON = "../../../test/data/apply/rc.json" filenameRCJSON = "../../../testdata/apply/rc.json"
filenameWidgetClientside = "../../../test/data/apply/widget-clientside.yaml" filenameWidgetClientside = "../../../testdata/apply/widget-clientside.yaml"
filenameWidgetServerside = "../../../test/data/apply/widget-serverside.yaml" filenameWidgetServerside = "../../../testdata/apply/widget-serverside.yaml"
filenameDeployObjServerside = "../../../test/data/apply/deploy-serverside.yaml" filenameDeployObjServerside = "../../../testdata/apply/deploy-serverside.yaml"
filenameDeployObjClientside = "../../../test/data/apply/deploy-clientside.yaml" filenameDeployObjClientside = "../../../testdata/apply/deploy-clientside.yaml"
) )
func readConfigMapList(t *testing.T, filename string) [][]byte { func readConfigMapList(t *testing.T, filename string) [][]byte {

View File

@ -77,7 +77,7 @@ go_test(
"create_serviceaccount_test.go", "create_serviceaccount_test.go",
"create_test.go", "create_test.go",
], ],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library",

View File

@ -67,7 +67,7 @@ func TestCreateObject(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams() ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams) cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -104,8 +104,8 @@ func TestCreateMultipleObject(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams() ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams) cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml") cmd.Flags().Set("filename", "../../../testdata/frontend-service.yaml")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -141,7 +141,7 @@ func TestCreateDirectory(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams() ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams) cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../test/data/replace/legacy") cmd.Flags().Set("filename", "../../../testdata/replace/legacy")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})

View File

@ -31,7 +31,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["delete_test.go"], srcs = ["delete_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@ -237,7 +237,7 @@ func TestDeleteObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams) cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("cascade", "false") cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -317,7 +317,7 @@ func TestDeleteObjectNotFound(t *testing.T) {
options := &DeleteOptions{ options := &DeleteOptions{
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/redis-master-controller.yaml"}, Filenames: []string{"../../../testdata/redis-master-controller.yaml"},
}, },
GracePeriod: -1, GracePeriod: -1,
Cascade: false, Cascade: false,
@ -354,7 +354,7 @@ func TestDeleteObjectIgnoreNotFound(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams) cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("cascade", "false") cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("ignore-not-found", "true") cmd.Flags().Set("ignore-not-found", "true")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
@ -482,8 +482,8 @@ func TestDeleteMultipleObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams) cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml") cmd.Flags().Set("filename", "../../../testdata/frontend-service.yaml")
cmd.Flags().Set("cascade", "false") cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -520,7 +520,7 @@ func TestDeleteMultipleObjectContinueOnMissing(t *testing.T) {
options := &DeleteOptions{ options := &DeleteOptions{
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/redis-master-controller.yaml", "../../../test/data/frontend-service.yaml"}, Filenames: []string{"../../../testdata/redis-master-controller.yaml", "../../../testdata/frontend-service.yaml"},
}, },
GracePeriod: -1, GracePeriod: -1,
Cascade: false, Cascade: false,
@ -604,7 +604,7 @@ func TestDeleteDirectory(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams) cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/replace/legacy") cmd.Flags().Set("filename", "../../../testdata/replace/legacy")
cmd.Flags().Set("cascade", "false") cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})

View File

@ -25,7 +25,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["describe_test.go"], srcs = ["describe_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",

View File

@ -126,7 +126,7 @@ func TestDescribeObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDescribe("kubectl", tf, streams) cmd := NewCmdDescribe("kubectl", tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
if d.Name != "redis-master" || d.Namespace != "test" { if d.Name != "redis-master" || d.Namespace != "test" {

View File

@ -33,7 +33,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["expose_test.go"], srcs = ["expose_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@ -306,7 +306,7 @@ func TestRunExposeService(t *testing.T) {
Selector: map[string]string{"app": "go"}, Selector: map[string]string{"app": "go"},
}, },
}, },
flags: map[string]string{"filename": "../../../test/data/redis-master-service.yaml", "selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test", "dry-run": "true"}, flags: map[string]string{"filename": "../../../testdata/redis-master-service.yaml", "selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test", "dry-run": "true"},
output: &corev1.Service{ output: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"svc": "test"}}, ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"svc": "test"}},
Spec: corev1.ServiceSpec{ Spec: corev1.ServiceSpec{

View File

@ -73,7 +73,7 @@ go_test(
"humanreadable_flags_test.go", "humanreadable_flags_test.go",
"sorter_test.go", "sorter_test.go",
], ],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library",

View File

@ -54,8 +54,7 @@ import (
) )
var ( var (
openapiSchemaPath = filepath.Join("..", "..", "..", "..", "api", "openapi-spec", "swagger.json") openapiSchemaPath = filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json")
grace = int64(30) grace = int64(30)
enableServiceLinks = corev1.DefaultEnableServiceLinks enableServiceLinks = corev1.DefaultEnableServiceLinks
) )
@ -1079,7 +1078,7 @@ func TestGetObjectsIdentifiedByFile(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdGet("kubectl", tf, streams) cmd := NewCmdGet("kubectl", tf, streams)
cmd.SetOutput(buf) cmd.SetOutput(buf)
cmd.Flags().Set("filename", "../../../test/data/controller.yaml") cmd.Flags().Set("filename", "../../../testdata/controller.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
expected := `NAME AGE expected := `NAME AGE
@ -1105,7 +1104,7 @@ func TestGetTableObjectsIdentifiedByFile(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdGet("kubectl", tf, streams) cmd := NewCmdGet("kubectl", tf, streams)
cmd.SetOutput(buf) cmd.SetOutput(buf)
cmd.Flags().Set("filename", "../../../test/data/controller.yaml") cmd.Flags().Set("filename", "../../../testdata/controller.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
expected := `NAME READY STATUS RESTARTS AGE expected := `NAME READY STATUS RESTARTS AGE
@ -2495,7 +2494,7 @@ func TestWatchResourceIdentifiedByFile(t *testing.T) {
cmd.SetOutput(buf) cmd.SetOutput(buf)
cmd.Flags().Set("watch", "true") cmd.Flags().Set("watch", "true")
cmd.Flags().Set("filename", "../../../test/data/controller.yaml") cmd.Flags().Set("filename", "../../../testdata/controller.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
expected := `NAME AGE expected := `NAME AGE

View File

@ -31,7 +31,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["label_test.go"], srcs = ["label_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@ -392,7 +392,7 @@ func TestLabelForResourceFromFile(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams() ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdLabel(tf, ioStreams) cmd := NewCmdLabel(tf, ioStreams)
opts := NewLabelOptions(ioStreams) opts := NewLabelOptions(ioStreams)
opts.Filenames = []string{"../../../test/data/controller.yaml"} opts.Filenames = []string{"../../../testdata/controller.yaml"}
err := opts.Complete(tf, cmd, []string{"a=b"}) err := opts.Complete(tf, cmd, []string{"a=b"})
if err == nil { if err == nil {
err = opts.Validate() err = opts.Validate()
@ -424,7 +424,7 @@ func TestLabelLocal(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams() ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdLabel(tf, ioStreams) cmd := NewCmdLabel(tf, ioStreams)
opts := NewLabelOptions(ioStreams) opts := NewLabelOptions(ioStreams)
opts.Filenames = []string{"../../../test/data/controller.yaml"} opts.Filenames = []string{"../../../testdata/controller.yaml"}
opts.local = true opts.local = true
err := opts.Complete(tf, cmd, []string{"a=b"}) err := opts.Complete(tf, cmd, []string{"a=b"})
if err == nil { if err == nil {

View File

@ -31,7 +31,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["patch_test.go"], srcs = ["patch_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library", "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",

View File

@ -95,7 +95,7 @@ func TestPatchObjectFromFile(t *testing.T) {
cmd.Flags().Set("namespace", "test") cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`) cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`)
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml") cmd.Flags().Set("filename", "../../../testdata/frontend-service.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
// uses the name from the response // uses the name from the response
@ -181,7 +181,7 @@ func TestPatchObjectFromFileOutput(t *testing.T) {
cmd.Flags().Set("namespace", "test") cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`) cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`)
cmd.Flags().Set("output", "yaml") cmd.Flags().Set("output", "yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml") cmd.Flags().Set("filename", "../../../testdata/frontend-service.yaml")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
t.Log(buf.String()) t.Log(buf.String())

View File

@ -28,7 +28,7 @@ go_library(
go_test( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["replace_test.go"], srcs = ["replace_test.go"],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@ -65,7 +65,7 @@ func TestReplaceObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams) cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -135,8 +135,8 @@ func TestReplaceMultipleObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams) cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml") cmd.Flags().Set("filename", "../../../testdata/frontend-service.yaml")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -192,7 +192,7 @@ func TestReplaceDirectory(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams) cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/replace/legacy") cmd.Flags().Set("filename", "../../../testdata/replace/legacy")
cmd.Flags().Set("namespace", "test") cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{}) cmd.Run(cmd, []string{})
@ -238,7 +238,7 @@ func TestForceReplaceObjectNotFound(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams() streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams) cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml") cmd.Flags().Set("filename", "../../../testdata/redis-master-controller.yaml")
cmd.Flags().Set("force", "true") cmd.Flags().Set("force", "true")
cmd.Flags().Set("cascade", "false") cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name") cmd.Flags().Set("output", "name")

View File

@ -57,7 +57,7 @@ go_test(
"set_subject_test.go", "set_subject_test.go",
"set_test.go", "set_test.go",
], ],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library",

View File

@ -60,7 +60,7 @@ func TestSetEnvLocal(t *testing.T) {
opts := NewEnvOptions(streams) opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme) opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{ opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../test/data/controller.yaml"}, Filenames: []string{"../../../testdata/controller.yaml"},
} }
opts.Local = true opts.Local = true
@ -97,7 +97,7 @@ func TestSetEnvLocalNamespace(t *testing.T) {
opts := NewEnvOptions(streams) opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme) opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{ opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../test/data/set/namespaced-resource.yaml"}, Filenames: []string{"../../../testdata/set/namespaced-resource.yaml"},
} }
opts.Local = true opts.Local = true
@ -134,7 +134,7 @@ func TestSetMultiResourcesEnvLocal(t *testing.T) {
opts := NewEnvOptions(streams) opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme) opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{ opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}, Filenames: []string{"../../../testdata/set/multi-resource-yaml.yaml"},
} }
opts.Local = true opts.Local = true

View File

@ -67,7 +67,7 @@ func TestImageLocal(t *testing.T) {
opts := SetImageOptions{ opts := SetImageOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/controller.yaml"}}, Filenames: []string{"../../../testdata/controller.yaml"}},
Local: true, Local: true,
IOStreams: streams, IOStreams: streams,
} }
@ -179,7 +179,7 @@ func TestSetMultiResourcesImageLocal(t *testing.T) {
opts := SetImageOptions{ opts := SetImageOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}}, Filenames: []string{"../../../testdata/set/multi-resource-yaml.yaml"}},
Local: true, Local: true,
IOStreams: streams, IOStreams: streams,
} }

View File

@ -66,7 +66,7 @@ func TestResourcesLocal(t *testing.T) {
opts := SetResourcesOptions{ opts := SetResourcesOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/controller.yaml"}}, Filenames: []string{"../../../testdata/controller.yaml"}},
Local: true, Local: true,
Limits: "cpu=200m,memory=512Mi", Limits: "cpu=200m,memory=512Mi",
Requests: "cpu=200m,memory=512Mi", Requests: "cpu=200m,memory=512Mi",
@ -114,7 +114,7 @@ func TestSetMultiResourcesLimitsLocal(t *testing.T) {
opts := SetResourcesOptions{ opts := SetResourcesOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{ FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}}, Filenames: []string{"../../../testdata/set/multi-resource-yaml.yaml"}},
Local: true, Local: true,
Limits: "cpu=200m,memory=512Mi", Limits: "cpu=200m,memory=512Mi",
Requests: "cpu=200m,memory=512Mi", Requests: "cpu=200m,memory=512Mi",

View File

@ -57,11 +57,11 @@ func TestSetServiceAccountLocal(t *testing.T) {
yaml string yaml string
apiGroup string apiGroup string
}{ }{
{yaml: "../../../test/data/set/replication.yaml", apiGroup: ""}, {yaml: "../../../testdata/set/replication.yaml", apiGroup: ""},
{yaml: "../../../test/data/set/daemon.yaml", apiGroup: "extensions"}, {yaml: "../../../testdata/set/daemon.yaml", apiGroup: "extensions"},
{yaml: "../../../test/data/set/redis-slave.yaml", apiGroup: "extensions"}, {yaml: "../../../testdata/set/redis-slave.yaml", apiGroup: "extensions"},
{yaml: "../../../test/data/set/job.yaml", apiGroup: "batch"}, {yaml: "../../../testdata/set/job.yaml", apiGroup: "batch"},
{yaml: "../../../test/data/set/deployment.yaml", apiGroup: "extensions"}, {yaml: "../../../testdata/set/deployment.yaml", apiGroup: "extensions"},
} }
for i, input := range inputs { for i, input := range inputs {
@ -122,7 +122,7 @@ func TestSetServiceAccountMultiLocal(t *testing.T) {
opts := SetServiceAccountOptions{ opts := SetServiceAccountOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
fileNameOptions: resource.FilenameOptions{ fileNameOptions: resource.FilenameOptions{
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}}, Filenames: []string{"../../../testdata/set/multi-resource-yaml.yaml"}},
local: true, local: true,
IOStreams: streams, IOStreams: streams,
} }

View File

@ -30,7 +30,7 @@ go_test(
"openapi_suite_test.go", "openapi_suite_test.go",
"openapi_test.go", "openapi_test.go",
], ],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -28,7 +28,7 @@ import (
"k8s.io/kubectl/pkg/util/openapi" "k8s.io/kubectl/pkg/util/openapi"
) )
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "test", "data", "openapi", "swagger.json")} var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "testdata", "openapi", "swagger.json")}
var _ = Describe("Reading apps/v1beta1/Deployment from openAPIData", func() { var _ = Describe("Reading apps/v1beta1/Deployment from openAPIData", func() {
var resources openapi.Resources var resources openapi.Resources

View File

@ -22,7 +22,7 @@ go_test(
"validation_suite_test.go", "validation_suite_test.go",
"validation_test.go", "validation_test.go",
], ],
data = ["//staging/src/k8s.io/kubectl/test/data"], data = ["//staging/src/k8s.io/kubectl/testdata"],
embed = [":go_default_library"], embed = [":go_default_library"],
deps = [ deps = [
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",

View File

@ -30,7 +30,7 @@ import (
"k8s.io/kubectl/pkg/util/openapi" "k8s.io/kubectl/pkg/util/openapi"
) )
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "..", "test", "data", "openapi", "swagger.json")} var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "..", "testdata", "openapi", "swagger.json")}
var _ = Describe("resource validation using OpenAPI Schema", func() { var _ = Describe("resource validation using OpenAPI Schema", func() {
var validator *SchemaValidation var validator *SchemaValidation

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
filegroup( filegroup(
name = "data", name = "testdata",
srcs = glob([ srcs = glob([
"**/*.yaml", "**/*.yaml",
"**/*.yml", "**/*.yml",