m/n/c/cluster: implement register flow
Change-Id: I197cbfa96d34c9912c7fc19710db25276e7440fc
Reviewed-on: https://review.monogon.dev/c/monogon/+/454
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/test/e2e/main_test.go b/metropolis/test/e2e/main_test.go
index 4e1c2c5..72fa619 100644
--- a/metropolis/test/e2e/main_test.go
+++ b/metropolis/test/e2e/main_test.go
@@ -18,7 +18,6 @@
import (
"context"
- "crypto/ed25519"
"errors"
"fmt"
"log"
@@ -80,9 +79,10 @@
defer cancel()
// Launch cluster.
- cluster, err := cluster.LaunchCluster(ctx, cluster.ClusterOptions{
- NumNodes: 1,
- })
+ clusterOptions := cluster.ClusterOptions{
+ NumNodes: 2,
+ }
+ cluster, err := cluster.LaunchCluster(ctx, clusterOptions)
if err != nil {
t.Fatalf("LaunchCluster failed: %v", err)
}
@@ -106,22 +106,11 @@
return fmt.Errorf("GetClusterInfo: %w", err)
}
- // Ensure the node is there with its address.
+ // Ensure that the expected node count is present.
nodes := res.ClusterDirectory.Nodes
- if want, got := 1, len(nodes); want != got {
+ if want, got := clusterOptions.NumNodes, len(nodes); want != got {
return fmt.Errorf("wanted %d nodes in cluster directory, got %d", want, got)
}
- node := nodes[0]
- if want, got := ed25519.PublicKeySize, len(node.PublicKey); want != got {
- return fmt.Errorf("wanted %d bytes long public key, got %d", want, got)
- }
- if want, got := 1, len(node.Addresses); want != got {
- return fmt.Errorf("wanted %d node address, got %d", want, got)
- }
- if want, got := "10.1.0.2", node.Addresses[0].Host; want != got {
- return fmt.Errorf("wanted status address %q, got %q", want, got)
- }
-
return nil
})
})