-
Notifications
You must be signed in to change notification settings - Fork 94
Added PUT Update LAN Coordinates endpoints, added tests for it #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
4ad25b5
82627a7
69e27fb
fb98725
cac8204
ed68a0d
86209c9
cc4be02
500040c
c010c25
f85e68f
c4b1cd5
51a1e9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,5 +73,46 @@ public async Task Coordinate_GetNode() | |
| Assert.IsType<CoordinateEntry[]>(nodeDetails); | ||
| Assert.NotEmpty(nodeDetails); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task Coordinate_Update() | ||
| { | ||
| var nodeName = "foo-update-lan"; | ||
| var registration = new CatalogRegistration | ||
| { | ||
| Node = nodeName, | ||
| Address = "1.1.1.1" | ||
| }; | ||
| var register = await _client.Catalog.Register(registration); | ||
|
|
||
| var coord = new CoordinateEntry | ||
| { | ||
| Node = nodeName, | ||
| Coord = new SerfCoordinate() | ||
| }; | ||
| coord.Coord.Error = 1.5; | ||
| coord.Coord.Height = 0.5; | ||
| coord.Coord.Adjustment = 0.0; | ||
| for (int i = 0; i < 8; i++) coord.Coord.Vec.Add(0.0); | ||
|
|
||
| var response = await _client.Coordinate.Update(coord); | ||
| Assert.Equal("OK", response.StatusCode.ToString()); | ||
IvanKolchanov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| var newCoordResult = await _client.Coordinate.Node(nodeName); | ||
| for (int i = 0; i < 5; i++) | ||
|
||
| { | ||
| if (newCoordResult.Response != null) break; | ||
| await Task.Delay(1000 * 2); | ||
| newCoordResult = await _client.Coordinate.Node(nodeName); | ||
| } | ||
|
|
||
| Assert.NotNull(newCoordResult.Response); | ||
| var newCoord = newCoordResult.Response[0]; | ||
| Assert.Equal(coord.Coord.Vec.Count, newCoord.Coord.Vec.Count); | ||
| Assert.Equal(coord.Node, newCoord.Node); | ||
| Assert.True(Math.Abs(coord.Coord.Height - newCoord.Coord.Height) <= 0.00001); | ||
| Assert.True(Math.Abs(coord.Coord.Adjustment - newCoord.Coord.Adjustment) <= 0.00001); | ||
| Assert.True(Math.Abs(coord.Coord.Error - newCoord.Coord.Error) <= 0.00001); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,5 +32,6 @@ public interface ICoordinateEndpoint | |
| Task<QueryResult<CoordinateEntry[]>> Node(string node, QueryOptions q, CancellationToken ct = default); | ||
| Task<QueryResult<CoordinateEntry[]>> Node(string node, CancellationToken ct = default); | ||
| Task<QueryResult<CoordinateEntry[]>> Nodes(QueryOptions q, CancellationToken ct = default); | ||
| Task<WriteResult> Update(CoordinateEntry entry, CancellationToken ct = default); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we also need a variant with |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.