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

757 - Integration test for Hot Reload of nodes #764

Open
wants to merge 4 commits into
base: agent/master
Choose a base branch
from

Conversation

paulchandler
Copy link

New classes to test eccChronos deals with nodes being added to the cluster or nodes being decommissioned.

@paulchandler paulchandler requested a review from a team as a code owner November 7, 2024 14:11
Comment on lines 68 to 70
<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>application</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicated?

Copy link
Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 72 to 76
<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>application</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
Copy link
Contributor

Choose a reason for hiding this comment

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

We like to put internal dependencies on the top of all, with a comment saying "Internal", check this pom.xml

Copy link
Author

Choose a reason for hiding this comment

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

Done


protected void decommissionNode ( String node) throws IOException, InterruptedException
{
String stdout = composeContainer.getContainerByServiceName(node).get()
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a void method, there's no reason to get the stdout and to create a variable to store this stdout

Copy link
Author

Choose a reason for hiding this comment

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

Done

{
private static final Logger LOG = LoggerFactory.getLogger(TestNodeAddition.class);
@BeforeClass
public static void setup() throws InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

public static void setup() throws InterruptedException { -->

public static void setup() throws InterruptedException
{
...
}

Copy link
Author

Choose a reason for hiding this comment

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

Done

import java.nio.file.Path;
import java.nio.file.Paths;

import static org.mockito.Mockito.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid importing all methods, actually our pmd should be failing because of this, but for some reason this module is untouchable

Copy link
Author

Choose a reason for hiding this comment

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

Done

composeContainer.withScaledService("cassandra-seed-dc2-rack1-node1", 1 );
composeContainer.start();
LOG.info("Waiting for the new nodes to finish starting up.");
Thread.sleep(50000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that too much time to sleep? Also, I think it'd be better to put this in a constant, like SLEEP_TIME_IN_MS

Copy link
Author

Choose a reason for hiding this comment

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

I changed this, with a new method to wait until the cluster is all UP

// scale up new nodes
composeContainer.withScaledService("cassandra-node-dc1-rack1-node2", 1 );
composeContainer.withScaledService("cassandra-node-dc2-rack1-node2", 1 );
composeContainer.withScaledService("cassandra-seed-dc2-rack1-node1", 1 );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think after scalling the nodes you should assert that the number of nodes increased, you can do it by checking stdout of nodetool status or using the driver

Copy link
Author

Choose a reason for hiding this comment

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

Done with new method in AbstractCassandraCluster

@Test
public void testAdditionalNodesAddedToCluster() throws InterruptedException
{
DefaultRepairConfigurationProvider listener = mock(DefaultRepairConfigurationProvider.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure, but as it's an IT, I think it would be good to create the main objects and run it instead of using mock

Copy link
Author

Choose a reason for hiding this comment

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

We have agreed not to do this


import static org.mockito.Mockito.*;

public class TestNodeAddition extends AbstractCassandraCluster
Copy link
Contributor

Choose a reason for hiding this comment

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

ITNodeAddition

Copy link
Author

Choose a reason for hiding this comment

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

Done

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

public class TestNodeRemoval extends AbstractCassandraCluster
Copy link
Contributor

Choose a reason for hiding this comment

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

ITNodeRemoval

Copy link
Author

Choose a reason for hiding this comment

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

Done

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.

2 participants