-
Notifications
You must be signed in to change notification settings - Fork 77
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
[Backend]Test launch/relaunch/pause of a simulation (#1488) #2025
base: release/1.10.0
Are you sure you want to change the base?
Conversation
9abfa01
to
bb18c81
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release/1.10.0 #2025 +/- ##
====================================================
+ Coverage 34.06% 34.60% +0.54%
- Complexity 1305 1331 +26
====================================================
Files 522 522
Lines 15720 15720
Branches 976 976
====================================================
+ Hits 5355 5440 +85
+ Misses 10102 10010 -92
- Partials 263 270 +7 ☔ View full report in Codecov by Sentry. |
List<ExecutableInject> injects = injectHelper.getInjectsToRun(); | ||
List<Pause> pauses = pauseRepository.findAllForExercise(PAUSED_EXERCISE.getId()); | ||
Exercise responseExercise = | ||
exerciseRepository.findById(JsonPath.read(response, "$.exercise_id")).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : You should check isPresent before doing a get here :)
|
||
// --ASSERT-- | ||
Exercise responseExercise = | ||
exerciseRepository.findById(JsonPath.read(response, "$.exercise_id")).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : Same as https://github.com/OpenBAS-Platform/openbas/pull/2025/files#r1879835425
Exercise responseExercise = | ||
exerciseRepository.findById(JsonPath.read(response, "$.exercise_id")).get(); | ||
assertEquals( | ||
responseExercise.getCurrentPause().get().truncatedTo(MINUTES), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : Same as https://github.com/OpenBAS-Platform/openbas/pull/2025/files#r1879835425
|
||
// --ASSERT-- | ||
Exercise responseExercise = | ||
exerciseRepository.findById(JsonPath.read(response, "$.exercise_id")).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : Same as https://github.com/OpenBAS-Platform/openbas/pull/2025/files#r1879835425
Exercise responseExercise = | ||
exerciseRepository.findById(JsonPath.read(response, "$.exercise_id")).get(); | ||
assertEquals( | ||
responseExercise.getEnd().get().truncatedTo(MINUTES), Instant.now().truncatedTo(MINUTES)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : Same as https://github.com/OpenBAS-Platform/openbas/pull/2025/files#r1879835425
@@ -44,4 +47,70 @@ public static Exercise createDefaultIncidentResponseExercise() { | |||
exercise.setStart(Instant.now()); | |||
return exercise; | |||
} | |||
|
|||
public static Exercise createDefaultAttackExercise() { | |||
Exercise exercise = new Exercise(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts : I think Hedi suggested to have builders. Lombok provides a @builder annotation that creates one. Maybe we should look into this at some point ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from a few nitpicks, this looks good
#1488