metropolis/test/launch: convert :launch to a test

"bazel run" simply executes the binary outside the sandbox, so swtpm
and other dependencies from the sandbox sysroot won't be available.

If swtpm is installed on the host, running the _bin target still works,
but it's better to point contributors to something that works
out of the box.

This is a temporary workaround. Tests have timeouts and take the global
Bazel server lock. The correct solution is a static swtpm build
which can run outside the sandbox.

Change-Id: Icf7bf5cc44825df676d37a75ea9c1e135de14fef
Reviewed-on: https://review.monogon.dev/c/monogon/+/1078
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/BUILD b/BUILD
index 33181b0..06407d2 100644
--- a/BUILD
+++ b/BUILD
@@ -73,15 +73,21 @@
 )
 
 # Shortcut for launching a single Metropolis node instance in a VM.
-alias(
+test_suite(
     name = "launch",
-    actual = "//metropolis/test/launch/cli/launch",
+    tags = ["manual"],
+    tests = [
+        "//metropolis/test/launch/cli/launch",
+    ],
 )
 
 # Shortcut for launching a virtual network a Metropolis cluster consisting of two nodes.
-alias(
+test_suite(
     name = "launch-multi2",
-    actual = "//metropolis/test/launch/cli/launch-multi2",
+    tags = ["manual"],
+    tests = [
+        "//metropolis/test/launch/cli/launch-multi2",
+    ],
 )
 
 alias(
diff --git a/README.md b/README.md
index a7ef169..db71d16 100644
--- a/README.md
+++ b/README.md
@@ -34,13 +34,17 @@
 
 ### Run a single node demo cluster
 
-Launch the node:
+Build CLI and node image:
 
-    bazel run //:launch -c dbg
+    bazel build //metropolis/cli/dbg //:launch -c dbg
+
+Launch an ephemeral test node:
+
+    bazel test //:launch -c dbg --test_output=streamed
     
-Run a kubectl command:
+Run a kubectl command while the test is running:
 
-    bazel run //metropolis/cli/dbg -c dbg -- kubectl describe node
+    bazel-bin/metropolis/cli/dbg/dbg_/dbg kubectl describe node
  
 ### Test suite
 
diff --git a/metropolis/README.md b/metropolis/README.md
index 28fbb45..6c9ad57 100644
--- a/metropolis/README.md
+++ b/metropolis/README.md
@@ -1,11 +1 @@
 # Metropolis Operating System
-
-## Launch VM
-
-Launch the VM:
-
-```
-scripts/bin/bazel run //core/scripts:launch
-```
-
-Ctrl-C will kill the VM.
diff --git a/metropolis/test/launch/cli/launch-multi2/BUILD.bazel b/metropolis/test/launch/cli/launch-multi2/BUILD.bazel
index c53b626..e56d131 100644
--- a/metropolis/test/launch/cli/launch-multi2/BUILD.bazel
+++ b/metropolis/test/launch/cli/launch-multi2/BUILD.bazel
@@ -1,4 +1,5 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@bazel_skylib//rules:native_binary.bzl", "native_test")
 
 go_library(
     name = "launch-multi2_lib",
@@ -12,7 +13,7 @@
 )
 
 go_binary(
-    name = "launch-multi2",
+    name = "launch-multi2_bin",
     data = [
         "//metropolis/node:image",
         "//metropolis/node:swtpm_data",
@@ -24,3 +25,11 @@
     embed = [":launch-multi2_lib"],
     visibility = ["//:__pkg__"],
 )
+
+native_test(
+    name = "launch-multi2",
+    src = ":launch-multi2_bin",
+    out = "launch-multi2",
+    tags = ["manual"],
+    visibility = ["//visibility:public"],
+)
diff --git a/metropolis/test/launch/cli/launch/BUILD.bazel b/metropolis/test/launch/cli/launch/BUILD.bazel
index 31d491a..2e58632 100644
--- a/metropolis/test/launch/cli/launch/BUILD.bazel
+++ b/metropolis/test/launch/cli/launch/BUILD.bazel
@@ -1,4 +1,5 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@bazel_skylib//rules:native_binary.bzl", "native_test")
 
 go_library(
     name = "launch_lib",
@@ -14,7 +15,7 @@
 )
 
 go_binary(
-    name = "launch",
+    name = "launch_bin",
     data = [
         "//metropolis/node:image",
         "//metropolis/node:swtpm_data",
@@ -23,3 +24,13 @@
     embed = [":launch_lib"],
     visibility = ["//:__pkg__"],
 )
+
+# Wrap the binary in a native_test so that we can run it with the
+# `bazel test` command inside the sandbox.
+native_test(
+    name = "launch",
+    src = ":launch_bin",
+    out = "launch",
+    tags = ["manual"],
+    visibility = ["//visibility:public"],
+)