m/proto: Add RunningCurator to status, report in status pusher
This data allows more dynamic reporting of a node's Curator status, and
notably allows reporting which port it's running on.
We weren't planning on supporting running on non-standard ports, and we
probably still don't, but it's actually super useful to have this
ability in (future) tests.
We use the opportunity to refactor the roleserver's statuspush worker,
and to add a test for it.
Change-Id: I53322e6c8d268186ede085d4a05b646acb422a6b
Reviewed-on: https://review.monogon.dev/c/monogon/+/793
Reviewed-by: Mateusz Zalega <mateusz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/roleserve/BUILD.bazel b/metropolis/node/core/roleserve/BUILD.bazel
index 3ac818d..2c9610c 100644
--- a/metropolis/node/core/roleserve/BUILD.bazel
+++ b/metropolis/node/core/roleserve/BUILD.bazel
@@ -1,4 +1,4 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "roleserve",
@@ -35,7 +35,26 @@
"//metropolis/proto/common",
"//metropolis/proto/private",
"@org_golang_google_grpc//:go_default_library",
+ "@org_golang_google_protobuf//encoding/prototext",
"@org_golang_google_protobuf//proto",
"@org_golang_x_sys//unix",
],
)
+
+go_test(
+ name = "roleserve_test",
+ srcs = ["worker_statuspush_test.go"],
+ embed = [":roleserve"],
+ deps = [
+ "//metropolis/node",
+ "//metropolis/node/core/curator/proto/api",
+ "//metropolis/pkg/supervisor",
+ "//metropolis/proto/common",
+ "@com_github_cenkalti_backoff_v4//:backoff",
+ "@com_github_google_go_cmp//cmp",
+ "@org_golang_google_grpc//:go_default_library",
+ "@org_golang_google_grpc//credentials/insecure",
+ "@org_golang_google_grpc//test/bufconn",
+ "@org_golang_google_protobuf//testing/protocmp",
+ ],
+)