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

Integration tests framework mszczygiel part4 #1804

Conversation

szczygiel-m
Copy link
Contributor

@szczygiel-m szczygiel-m commented Dec 18, 2023

  • 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
@szczygiel-m szczygiel-m marked this pull request as ready for review December 28, 2023 11:36
@moscicky moscicky self-assigned this Dec 28, 2023
@szczygiel-m szczygiel-m force-pushed the integration_tests_framework_mszczygiel_part4 branch from 4869acb to 3dda3c9 Compare December 28, 2023 12:36
@@ -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());
Copy link
Collaborator

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() {
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
TestSecurityProvider.setUserIsAdmin(true);
TestSecurityProvider.reset();

}

@Test
public void shouldAllowNonModifyingOperations() {
Copy link
Collaborator

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();
Copy link
Collaborator

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();
Copy link
Collaborator

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 {
Copy link
Collaborator

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() {
Copy link
Collaborator

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() {
Copy link
Collaborator

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() {
Copy link
Collaborator

@moscicky moscicky Dec 28, 2023

Choose a reason for hiding this comment

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

  1. 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?

  2. 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)
Copy link
Collaborator

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)
        );
    }

@szczygiel-m szczygiel-m merged commit 997b7fa into integration_tests_framework Dec 29, 2023
7 checks passed
@szczygiel-m szczygiel-m deleted the integration_tests_framework_mszczygiel_part4 branch December 29, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants