-
Notifications
You must be signed in to change notification settings - Fork 218
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
Integration tests framework mszczygiel part4 #1804
Integration tests framework mszczygiel part4 #1804
Conversation
szczygiel-m
commented
Dec 18, 2023
•
edited
Loading
edited
- GroupManagementTest
- OfflineRetransmissionManagementTest
- ReadOnlyModeTest
- SubscriptionManagementTest
- TopicManagementTest tests with BrokerOperations
…mework_mszczygiel_part4 # Conflicts: # integration-tests/src/common/java/pl/allegro/tech/hermes/integrationtests/client/HermesTestClient.java # integration-tests/src/common/java/pl/allegro/tech/hermes/integrationtests/client/ManagementTestClient.java
…mework_mszczygiel_part4 # Conflicts: # integration-tests/src/common/java/pl/allegro/tech/hermes/integrationtests/client/HermesTestClient.java # integration-tests/src/common/java/pl/allegro/tech/hermes/integrationtests/client/ManagementTestClient.java # integration-tests/src/common/java/pl/allegro/tech/hermes/integrationtests/setup/HermesManagementTestApp.java # integration/src/integration/java/pl/allegro/tech/hermes/integration/management/OfflineRetransmissionManagementTest.java
4869acb
to
3dda3c9
Compare
@@ -37,7 +37,7 @@ public void shouldListSubscriptionsForOwnerId() { | |||
Subscription subscription3 = hermes.initHelper().createSubscription(subscriptionWithRandomName(topic.getName()).withOwner(new OwnerId("Plaintext", "ListSubForOwner - Team B")).build()); | |||
|
|||
// then | |||
assertThat(listSubscriptionsForOwner("ListSubForOwner - Team A")).containsExactly(subscription1.getName(), subscription2.getName()); | |||
assertThat(listSubscriptionsForOwner("ListSubForOwner - Team A")).contains(subscription1.getName(), subscription2.getName()); |
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.
Have you changed it because of ordering? If yes - containsOnly
is more suitable
public static final HermesExtension hermes = new HermesExtension(); | ||
|
||
@Test | ||
public void shouldEmmitAuditEventWhenGroupCreated() { |
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.
nit: emmit
should be replaces by emit
in test names
assertThat(getOfflineRetransmissionTasks().size()).isEqualTo(0); | ||
|
||
// cleanup | ||
TestSecurityProvider.setUserIsAdmin(true); |
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.
TestSecurityProvider.setUserIsAdmin(true); | |
TestSecurityProvider.reset(); |
} | ||
|
||
@Test | ||
public void shouldAllowNonModifyingOperations() { |
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.
i think this test should be called shouldAllowModifyingOperations
and should actually be performed by not admin user?
WebTestClient.ResponseSpec response = hermes.api().createGroup(Group.from(groupName)); | ||
|
||
// then | ||
response.expectStatus().is5xxServerError(); |
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.
can we check specifically for SERVICE_UNAVAILABLE
?
WebTestClient.ResponseSpec response = hermes.api().createGroup(Group.from(groupName)); | ||
|
||
// then | ||
response.expectStatus().is5xxServerError(); |
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.
SERVICE_UNAVAILABLE
?
import pl.allegro.tech.hermes.management.TestSecurityProvider; | ||
import pl.allegro.tech.hermes.management.domain.mode.ModeService; | ||
|
||
public class ReadOnlyModeTest { |
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.
nit: consider using random group names instead of hardcoded ones
} | ||
|
||
@Test | ||
public void shouldEmmitAuditEventWhenSubscriptionCreated() { |
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.
nit: emit instead of emmit in whole file
@@ -98,6 +98,23 @@ public TestSubscriber createSubscriberWithRetry(String message, int delay) { | |||
return subscriber; | |||
} | |||
|
|||
public TestSubscriber createSubscriberUnavailable() { |
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.
is this needed? I think that createSubscriber(503)
will be sufficient
} | ||
|
||
@Test | ||
public void topicCreationRollbackShouldNotDeleteTopicOnBroker() { |
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.
-
Do you have an idea what is a difference between these two tests? I don't understand where is the
Rollback
part coming from. Perhaps these two test should be merged? -
Previously this test was using multi DC setup, do you think this was not relevant?
@@ -139,6 +139,8 @@ public void clearManagementData() { | |||
removeSubscriptions(); | |||
removeTopics(); | |||
removeGroups(); | |||
waitAtMost(Duration.TEN_SECONDS) |
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.
this seems redundant, removeGroups already checks if groups are empty:
private void removeGroups() {
GroupService service = management.groupService();
List<Group> groups = service.listGroups();
for (Group group : groups) {
service.removeGroup(group.getGroupName(), testUser);
}
waitAtMost(adjust(Duration.ONE_MINUTE)).until(() ->
Assertions.assertThat(service.listGroups().size()).isEqualTo(0)
);
}