m/p/supervisor: deflake tests

This removes some poorly designed test code which attempted to
synchronize with a goroutine in a way that's unsound in Go's concurrency
model. Instead of doing a non-blocking read and failing if there is no
sending goroutine, we just block. Test timeouts will, in this case,
cause the test to error out.

Change-Id: I5338693c578c8eb8b494a1a651a04de6a54df15c
Reviewed-on: https://review.monogon.dev/c/monogon/+/445
Reviewed-by: Leopold Schabel <leo@nexantic.com>
diff --git a/metropolis/pkg/supervisor/supervisor_test.go b/metropolis/pkg/supervisor/supervisor_test.go
index cf303e8..7f2ffa4 100644
--- a/metropolis/pkg/supervisor/supervisor_test.go
+++ b/metropolis/pkg/supervisor/supervisor_test.go
@@ -63,11 +63,9 @@
 
 		<-ctx.Done()
 
-		go func() {
-			if done != nil {
-				done <- struct{}{}
-			}
-		}()
+		if done != nil {
+			done <- struct{}{}
+		}
 
 		return ctx.Err()
 	}
@@ -95,11 +93,9 @@
 
 		<-ctx.Done()
 
-		go func() {
-			if done != nil {
-				done <- struct{}{}
-			}
-		}()
+		if done != nil {
+			done <- struct{}{}
+		}
 		return ctx.Err()
 	}
 }
@@ -271,12 +267,7 @@
 
 	// Kill off two, one should restart.
 	two.die()
-	s.waitSettleError(ctx, t)
-	select {
-	case <-d1:
-	default:
-		t.Fatalf("runnable 'one' didn't acknowledge cancel")
-	}
+	<-d1
 
 	// And one should start running again.
 	s.waitSettleError(ctx, t)
@@ -318,12 +309,7 @@
 
 	// Kill off two, one should restart.
 	two.die()
-	s.waitSettleError(ctx, t)
-	select {
-	case <-d1:
-	default:
-		t.Fatalf("runnable 'one' didn't acknowledge cancel")
-	}
+	<-d1
 
 	// And one should start running again.
 	s.waitSettleError(ctx, t)
@@ -365,12 +351,7 @@
 
 	// Kill off two, one should restart.
 	two.panic()
-	s.waitSettleError(ctx, t)
-	select {
-	case <-d1:
-	default:
-		t.Fatalf("runnable 'one' didn't acknowledge cancel")
-	}
+	<-d1
 
 	// And one should start running again.
 	s.waitSettleError(ctx, t)