startAndSetupState starts the cluster via the provided startFunc. The crosscutting concern of setting up the ClusterState in the Context and making sure we don't start the cluster multiple times per Context is handled here
(start startFunc)
| 76 | // crosscutting concern of setting up the ClusterState in the Context and making |
| 77 | // sure we don't start the cluster multiple times per Context is handled here |
| 78 | func startAndSetupState(start startFunc) func(context.Context) (context.Context, error) { |
| 79 | return func(ctx context.Context) (context.Context, error) { |
| 80 | c := &ClusterState{} |
| 81 | ctx, err := testenv.SetupState(ctx, &c) |
| 82 | if err != nil { |
| 83 | return ctx, err |
| 84 | } |
| 85 | |
| 86 | if c.Up(ctx) { |
| 87 | return ctx, nil |
| 88 | } |
| 89 | |
| 90 | ctx, c.cluster, err = start(ctx) |
| 91 | |
| 92 | return ctx, err |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // mustBeUp makes sure that the cluster is up, used by functions that require |
| 97 | // the cluster to be up |
no test coverage detected