Skip to content

Commit

Permalink
Fix non-deterministic tests
Browse files Browse the repository at this point in the history
Select always the same robot to
schedule missions on
  • Loading branch information
Afonso-2403 committed Feb 28, 2024
1 parent da78052 commit 090ef81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/api.test/Client/AreaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public async Task MissionIsCreatedInArea()
Assert.True(robotResponse.IsSuccessStatusCode);
var robots = await robotResponse.Content.ReadFromJsonAsync<List<Robot>>(_serializerOptions);
Assert.True(robots != null);
var robot = robots[0];
var robot = robots.Where(robot => robot.Name == "Shockwave").First();
string robotId = robot.Id;

// Installation
Expand Down
6 changes: 3 additions & 3 deletions backend/api.test/Client/MissionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public async Task ScheduleOneEchoMissionTest()
Assert.True(response.IsSuccessStatusCode, $"Failed to get robot from path: {robotUrl}, with status code {response.StatusCode}");
var robots = await response.Content.ReadFromJsonAsync<List<Robot>>(_serializerOptions);
Assert.True(robots != null);
var robot = robots[0]; // We do not care which robot is used
var robot = robots.Where(robot => robot.Name == "Shockwave").First();
string robotId = robot.Id;

// Arrange - Area
Expand Down Expand Up @@ -281,7 +281,7 @@ public async Task Schedule3EchoMissionsTest()
Assert.True(robotResponse.IsSuccessStatusCode);
var robots = await robotResponse.Content.ReadFromJsonAsync<List<Robot>>(_serializerOptions);
Assert.True(robots != null);
var robot = robots[0];
var robot = robots.Where(robot => robot.Name == "Shockwave").First();
string robotId = robot.Id;

// Arrange - Area
Expand Down Expand Up @@ -624,7 +624,7 @@ public async Task ScheduleDuplicateEchoMissionDefinitions()
Assert.True(response.IsSuccessStatusCode);
var robots = await response.Content.ReadFromJsonAsync<List<Robot>>(_serializerOptions);
Assert.True(robots != null);
var robot = robots[0];
var robot = robots.Where(robot => robot.Name == "Shockwave").First();
string robotId = robot.Id;
int echoMissionId = 1; // Corresponds to mock in EchoServiceMock.cs

Expand Down

0 comments on commit 090ef81

Please sign in to comment.