(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestClientFindCoordinator(t *testing.T) { |
| 45 | client, shutdown := newLocalClient() |
| 46 | defer shutdown() |
| 47 | |
| 48 | ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) |
| 49 | defer cancel() |
| 50 | resp, err := waitForCoordinatorIndefinitely(ctx, client, &FindCoordinatorRequest{ |
| 51 | Addr: client.Addr, |
| 52 | Key: "TransactionalID-1", |
| 53 | KeyType: CoordinatorKeyTypeTransaction, |
| 54 | }) |
| 55 | if err != nil { |
| 56 | t.Fatal(err) |
| 57 | } |
| 58 | |
| 59 | if resp.Coordinator.Host != "localhost" { |
| 60 | t.Fatal("Coordinator should be found @ localhost") |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // WaitForCoordinatorIndefinitely is a blocking call till a coordinator is found. |
| 65 | func waitForCoordinatorIndefinitely(ctx context.Context, c *Client, req *FindCoordinatorRequest) (*FindCoordinatorResponse, error) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…