c/takeover/e2e: add takeover end-to-end test
This adds an end-to-end test to the takeover system.
It launches a QEMU VM running a Debian Cloud Image which is configured
via cloud-init to accept SSH access from the test.
It connects to that VM via SSH, copies the takeover binary under test
to it via SFTP and launches it.
It passes a test TakeoverInit message to it, performs basic sanity
checking on the response and then looks on the serial port for a flag
mesage that the agent has started.
Change-Id: I8edce6163259da305bb43660a2d70474f7f11612
Reviewed-on: https://review.monogon.dev/c/monogon/+/1262
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Leopold Schabel <leo@monogon.tech>
diff --git a/cloud/takeover/e2e/BUILD.bazel b/cloud/takeover/e2e/BUILD.bazel
new file mode 100644
index 0000000..82ccd7d
--- /dev/null
+++ b/cloud/takeover/e2e/BUILD.bazel
@@ -0,0 +1,20 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "e2e_test",
+ srcs = ["main_test.go"],
+ data = [
+ "//cloud/takeover",
+ "//third_party/edk2:firmware",
+ "@debian_11_cloudimage//file",
+ ],
+ deps = [
+ "//cloud/agent/api",
+ "//metropolis/cli/pkg/datafile",
+ "//metropolis/pkg/fat32",
+ "//metropolis/pkg/freeport",
+ "@com_github_pkg_sftp//:sftp",
+ "@org_golang_google_protobuf//proto",
+ "@org_golang_x_crypto//ssh",
+ ],
+)