Skip to content

Commit

Permalink
tests/smoke/BUILD.bazel: Drop the 'smoke' target
Browse files Browse the repository at this point in the history
The 'smoke' target is a lot like the Gazelle-maintained
go_default_test target, except that it's not automatically maintained.
Make maintenance easier by pointing the smoke_tests alias straight at
the automatically-maintained target.  Generated with:

  $ rm smoke/tests/BUILD.bazel
  $ bazel run //:gazelle
  $ emacs smoke/tests/BUILD.bazel  # add visibility

Adding the visibility property avoids:

  $ bazel run smoke_tests
  ERROR: /home/trking/.local/lib/go/src/github.com/openshift/installer/BUILD.bazel:45:1: target '//tests/smoke:go_default_test' is not visible from target '//:smoke_tests'. Check the visibility declaration of the former target if you think the dependency is legitimate
  ERROR: Analysis of target '//:smoke_tests' failed; build aborted: Analysis of target '//:smoke_tests' failed; build aborted
  INFO: Elapsed time: 0.124s
  INFO: 0 processes.
  FAILED: Build did NOT complete successfully (1 packages loaded)
  FAILED: Build did NOT complete successfully (1 packages loaded)

Running the smoke tests is also fairly orthogonal to building
tarballs, so I've removed the smoke-test docs from
Documentation/dev/build.md.

The last test_vars consumer was removed in 7296010 (frontend: Remove
frontend code and backend API code, 2018-03-06,
coreos/tectonic-installer#3067), so I don't think its removal will be
a problem.  And because smoke.sh was removed in 1dea5c8 (tests:
Remove unused smoke.sh + tfvars file, 2017-10-04,
coreos/tectonic-installer#2036), I've just removed the whole
tests/smoke/aws tree.  And without that tree to explain, I've dropped
the associated section from the smoke README as well.
  • Loading branch information
wking committed Aug 24, 2018
1 parent 60fb50a commit 71c27f6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 219 deletions.
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gazelle(

alias(
name = "smoke_tests",
actual = "//tests/smoke:smoke",
actual = "//tests/smoke:go_default_test",
)

alias(
Expand Down
14 changes: 0 additions & 14 deletions Documentation/dev/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,6 @@ tectonic_1.2.3-beta

*Note*: the generated tarball will not include the version string in its own name since output names must be known ahead of time in Bazel. To include the version in the tarball name, copy or move the archive with the desired name in the destination.

## Building the Smoke Test Binary

We also use Bazel to build the smoke test binary. To do so, run:

```sh
bazel build tests/smoke
```

This operation will produce a binary located at `bazel-bin/tests/smoke/linux_amd64_stripped/smoke`, if on a Linux machine, or `bazel-bin/tests/smoke/darwin_amd64_stripped/smoke`, if on a Mac.
Follow the [smoke test instructions][smoke-test] to test a Tectonic cluster using this newly compiled binary.


## Cleaning

You can cleanup all generated files by running:
Expand All @@ -110,5 +98,3 @@ Additionally you can remove all toolchains (in addition to the generated files)
```sh
bazel clean --expunge
```

[smoke-test]: ../../tests/smoke/README.md
6 changes: 3 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ function destroy() {
trap destroy EXIT

echo -e "\\e[36m Starting build process...\\e[0m"
bazel build tarball tests/smoke
bazel build tarball smoke_tests
# In future bazel build could be extracted to another job which could be running in docker container like this:
# docker run --rm -v $PWD:$PWD:Z -w $PWD quay.io/coreos/tectonic-builder:bazel-v0.3 bazel build tarball tests/smoke
# docker run --rm -v $PWD:$PWD:Z -w $PWD quay.io/coreos/tectonic-builder:bazel-v0.3 bazel build tarball smoke_tests

echo -e "\\e[36m Unpacking artifacts...\\e[0m"
tar -zxf bazel-bin/tectonic-dev.tar.gz
cp bazel-bin/tests/smoke/linux_amd64_stripped/smoke tectonic-dev/smoke
cp bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test tectonic-dev/smoke
export PATH="$(pwd)/tectonic-dev/installer:${PATH}"
cd tectonic-dev

Expand Down
39 changes: 2 additions & 37 deletions tests/smoke/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test", "go_prefix")

go_prefix("github.com/openshift/installer/tests/smoke/tests/smoke")

go_test(
name = "smoke",
srcs = [
"cluster_test.go",
"common_test.go",
"smoke_test.go",
],
visibility = ["//visibility:public"],
deps = [
"//tests/smoke/vendor/github.com/coreos/ktestutil/testworkload:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/kubernetes:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/pkg/api:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
"//tests/smoke/vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//tests/smoke/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util:go_default_library",
"//tests/smoke/vendor/k8s.io/kubernetes/pkg/kubectl/resource:go_default_library",
],
)
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_test",
Expand All @@ -35,6 +7,7 @@ go_test(
"common_test.go",
"smoke_test.go",
],
visibility = ["//visibility:public"],
deps = [
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//tests/smoke/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
Expand All @@ -46,11 +19,3 @@ go_test(
"//tests/smoke/vendor/k8s.io/kubernetes/pkg/kubectl/resource:go_default_library",
],
)

filegroup(
name = "test_vars",
srcs = [
"aws/vars/aws.tfvars.json",
],
visibility = ["//visibility:public"],
)
20 changes: 5 additions & 15 deletions tests/smoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

This directory contains all smoke tests for Tectonic.
The smoke tests are a set of Golang test files that perform minimal validation of a running Tectonic cluster.
This directory is further partitioned into platform-specific directories and should conform to the following directory hierarchy:

```
smoke/
├── aws # Smoke tests for AWS
│   └── vars # Terraform tfvars files for AWS smoke tests
├── *_test.go # Smoke tests for all platforms
├── vendor # Smoke test dependencies
└── ...
```

## Getting Started

Expand All @@ -34,18 +24,18 @@ Compile the smoke test binary from the root directory of the project:
bazel build tests/smoke
```

The tests can then be run by invoking the `smoke` binary in the `bazel-bin/tests/smoke/linux_amd64_stripped` directory.
The tests can then be run by invoking the `go_default_test` binary in the `bazel-bin/tests/smoke/linux_amd64_stripped` directory.
This binary accepts the `--cluster` flag to specify which tests suites should be run, e.g.:

```sh
bazel-bin/tests/smoke/linux_amd64_stripped/smoke --cluster
bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test --cluster
```

*Note*: the `smoke` binary accepts several flags available to the `go test` command; to list them, invoke the `smoke` binary with the `--help` flag.
*Note*: the `go_default_test` binary accepts several flags available to the `go test` command; to list them, invoke the `go_default_test` binary with the `--help` flag.
For example, to run the cluster suite verbosely, use the `--test.v` flag:

```sh
bazel-bin/tests/smoke/linux_amd64_stripped/smoke --cluster --test.v
bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test --cluster --test.v
```

## Cluster Suite
Expand All @@ -68,5 +58,5 @@ export SMOKE_MANIFEST_EXPERIMENTAL=true

To run the cluster test suite, invoke the smoke test binary with the `--cluster` flag:
```sh
bazel-bin/tests/smoke/linux_amd64_stripped/smoke --cluster
bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test --cluster
```
107 changes: 0 additions & 107 deletions tests/smoke/aws/README.md

This file was deleted.

42 changes: 0 additions & 42 deletions tests/smoke/aws/vars/aws-basic.yaml

This file was deleted.

0 comments on commit 71c27f6

Please sign in to comment.