Update type assertion logic
Logic updated to evaluate with a boolean after the type assertion. This allows us to check if the type assertion succeeded and be more clear with errors.
This commit is contained in:
parent
2052307c1c
commit
1ee6dd253b
|
@ -85,9 +85,14 @@ func TestCoordinate_Nodes(t *testing.T) {
|
|||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
coordinates := obj.(structs.Coordinates)
|
||||
if coordinates == nil || len(coordinates) != 0 {
|
||||
t.Fatalf("bad: %v", coordinates)
|
||||
// Check that coordinates are empty before registering a node
|
||||
coordinates, ok := obj.(structs.Coordinates)
|
||||
if !ok {
|
||||
t.Fatalf("expected: structs.Coordinates, received: %v", coordinates)
|
||||
}
|
||||
|
||||
if len(coordinates) != 0 {
|
||||
t.Fatalf("coordinates should be empty, received: %v", coordinates)
|
||||
}
|
||||
|
||||
// Register the nodes.
|
||||
|
|
Loading…
Reference in New Issue