diff --git a/agent/coordinate_endpoint_test.go b/agent/coordinate_endpoint_test.go index 208b05551e..060db6f6b5 100644 --- a/agent/coordinate_endpoint_test.go +++ b/agent/coordinate_endpoint_test.go @@ -63,6 +63,10 @@ func TestCoordinate_Datacenters(t *testing.T) { t.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + t.Fatalf("bad: %v", resp.Code) + } + maps := obj.([]structs.DatacenterMap) if len(maps) != 1 || maps[0].Datacenter != "dc1" || @@ -87,6 +91,10 @@ func TestCoordinate_Nodes(t *testing.T) { r.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + r.Fatalf("bad: %v", resp.Code) + } + // Check that coordinates are empty before registering a node coordinates, ok := obj.(structs.Coordinates) if !ok { @@ -144,6 +152,10 @@ func TestCoordinate_Nodes(t *testing.T) { r.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + r.Fatalf("bad: %v", resp.Code) + } + coordinates, ok := obj.(structs.Coordinates) if !ok { r.Fatalf("expected: structs.Coordinates, received: %+v", obj) @@ -163,6 +175,10 @@ func TestCoordinate_Nodes(t *testing.T) { r.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + r.Fatalf("bad: %v", resp.Code) + } + coordinates, ok := obj.(structs.Coordinates) if !ok { r.Fatalf("expected: structs.Coordinates, received: %+v", obj) @@ -180,6 +196,10 @@ func TestCoordinate_Nodes(t *testing.T) { r.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + r.Fatalf("bad: %v", resp.Code) + } + coordinates, ok := obj.(structs.Coordinates) if !ok { r.Fatalf("expected: structs.Coordinates, received: %+v", obj) @@ -220,6 +240,7 @@ func TestCoordinate_Node(t *testing.T) { if err != nil { t.Fatalf("err: %v", err) } + if resp.Code != http.StatusNotFound { t.Fatalf("bad: %v", resp.Code) } @@ -269,6 +290,10 @@ func TestCoordinate_Node(t *testing.T) { t.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + t.Fatalf("bad: %v", resp.Code) + } + coordinates := obj.(structs.Coordinates) if len(coordinates) != 1 || coordinates[0].Node != "foo" { @@ -294,6 +319,10 @@ func TestCoordinate_Node(t *testing.T) { t.Fatalf("err: %v", err) } + if resp.Code != http.StatusOK { + t.Fatalf("bad: %v", resp.Code) + } + coordinates = obj.(structs.Coordinates) if len(coordinates) != 1 || coordinates[0].Node != "foo" { t.Fatalf("bad: %v", coordinates) @@ -342,6 +371,11 @@ func TestCoordinate_Update(t *testing.T) { if err != nil { t.Fatalf("err: %v", err) } + + if resp.Code != http.StatusOK { + t.Fatalf("bad: %v", resp.Code) + } + time.Sleep(300 * time.Millisecond) // Query back and check the coordinates are present.