Skip to content
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

Use @DataMongoTest and @Testcontainers annotations in WorkerServiceTests #665

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

jbern0rd
Copy link
Contributor

@jbern0rd jbern0rd commented Feb 19, 2024

No description provided.

@jbern0rd jbern0rd self-assigned this Feb 19, 2024
@jbern0rd jbern0rd changed the title Use @DataMongoTest and @Testcontainers annotations in `WorkerSer… Use @DataMongoTest and @Testcontainers annotations in WorkerServiceTests Feb 19, 2024
@jbern0rd jbern0rd marked this pull request as ready for review February 19, 2024 18:30
private MongoTemplate mongoTemplate;
@Mock
@SpyBean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try and remove this @SpyBean annotation? It is used twice:

  • On line 192, to assert that a save has been done. This could be replaced by checking the object can be retrieved from the repository;
  • On line 479, to mock a call. This could be replaced by inserting the object beforehand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see aeb00e1

Assertions.assertThat(aliveWorkersGauge).isNotNull();
Assertions.assertThat(aliveTotalCpuGauge).isNotNull();
Assertions.assertThat(aliveAvailableCpuGauge).isNotNull();
assertThat(aliveWorkersGauge).isNotNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the test modification, you didn't take the opportunity to use assertAll ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see aeb00e1

Assertions.assertThat(aliveWorkersGauge.value()).isZero();
Assertions.assertThat(aliveTotalCpuGauge.value()).isZero();
Assertions.assertThat(aliveAvailableCpuGauge.value()).isZero();
assertThat(aliveWorkersGauge).isNotNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the test modification, you didn't take the opportunity to use assertAll ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see aeb00e1

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@mcornaton mcornaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jbern0rd jbern0rd merged commit b1dbd41 into develop Feb 20, 2024
2 checks passed
@jbern0rd jbern0rd deleted the bugfix/use-testcontainers-in-worker-service-tests branch February 20, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants