m/test/launch: fail ROC on non-UNAVAILABLE errors
This makes RetrieveOwnerKeys fail fast in tests if some non-transient
(ie. non-UNAVAILABLE) error is encountered. I hit this while developing
something around the codebase and it took me way too long to figure out
why the e2e test was stalling.
This really begs doing a pass on all retry loops to make sure we don't
get stuck like this. Perhaps we should formalize this, too.
Change-Id: I048f5ac79802330f789e67ba316bc38f04d83331
Reviewed-on: https://review.monogon.dev/c/monogon/+/531
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/rpc/client.go b/metropolis/node/core/rpc/client.go
index 10d2545..6f113e2 100644
--- a/metropolis/node/core/rpc/client.go
+++ b/metropolis/node/core/rpc/client.go
@@ -13,6 +13,7 @@
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
+ "google.golang.org/grpc/status"
"google.golang.org/grpc/test/bufconn"
"source.monogon.dev/metropolis/node/core/identity"
@@ -86,7 +87,10 @@
func RetrieveOwnerCertificate(ctx context.Context, aaa apb.AAAClient, private ed25519.PrivateKey) (*tls.Certificate, error) {
srv, err := aaa.Escrow(ctx)
if err != nil {
- return nil, fmt.Errorf("when opening Escrow RPC: %w", err)
+ if st, ok := status.FromError(err); ok {
+ return nil, status.Errorf(st.Code(), "Escrow call failed: %s", st.Message())
+ }
+ return nil, err
}
if err := srv.Send(&apb.EscrowFromClient{
Parameters: &apb.EscrowFromClient_Parameters{