build test binary with bazel

pull/6/head
Mike Danese 2016-12-14 15:55:23 -08:00
parent ee177dbbfe
commit c2b5007f1c
2 changed files with 15 additions and 7 deletions

View File

@ -1,6 +1,6 @@
git_repository( git_repository(
name = "io_bazel_rules_go", name = "io_bazel_rules_go",
commit = "c7e02c851a8faf803f260800e7387248ccd47683", commit = "d0142854a22a0dd98306280e897e64086289a0de",
remote = "https://github.com/bazelbuild/rules_go.git", remote = "https://github.com/bazelbuild/rules_go.git",
) )

View File

@ -5,6 +5,7 @@ licenses(["notice"])
load( load(
"@io_bazel_rules_go//go:def.bzl", "@io_bazel_rules_go//go:def.bzl",
"go_library", "go_library",
"go_test",
) )
go_library( go_library(
@ -218,18 +219,17 @@ go_library(
], ],
) )
# this is a private library until we can support building the go_test(
# test binary
# TODO(mikedanese): fix @io_bazelbuild/rules_go
go_library(
name = "go_default_test", name = "go_default_test",
srcs = [ srcs = [
"e2e_test.go", "e2e_test.go",
"metrics_grabber_test.go", "metrics_grabber_test.go",
], ],
library = ":go_default_library", library = ":go_default_library",
tags = ["automanaged"], tags = [
visibility = ["//visibility:private"], "automanaged",
"integration",
],
deps = [ deps = [
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library",
@ -240,6 +240,14 @@ go_library(
], ],
) )
genrule(
name = "gen_e2e.test",
testonly = 1,
srcs = [":go_default_test"],
outs = ["e2e.test"],
cmd = "set -x; srcs=($(SRCS)); cp $$(dirname $${srcs[0]})/go_default_test $@;",
)
filegroup( filegroup(
name = "package-srcs", name = "package-srcs",
srcs = glob(["**"]), srcs = glob(["**"]),