Skip to content

Commit

Permalink
Added stand alonde integration tests
Browse files Browse the repository at this point in the history
- Integration tests for on demand repairs
  • Loading branch information
sajid riaz committed Dec 10, 2024
1 parent c2ca685 commit 34e58f7
Show file tree
Hide file tree
Showing 11 changed files with 1,405 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
java-version: 17
distribution: 'temurin'
- name: install dependencies
run: mvn install -DskipTests=true
run: mvn install -Pbuild-cassandra-test-jar -DskipTests=true
- run: mvn $TEST_SUITE -B
id: tests
env:
Expand Down
11 changes: 9 additions & 2 deletions cassandra-test-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
<skip>false</skip>
</configuration>
</plugin>

<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
Expand All @@ -103,13 +103,20 @@
<profiles>
<profile>
<id>build-cassandra-test-jar</id>
<activation>
<property>
<name>build-cassandra-test-jar</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,25 @@ public ConcurrentHashMap<UUID, JMXConnector> getJmxConnections()
@Override
public JMXConnector getJmxConnector(final UUID nodeID)
{
return myJMXConnections.get(nodeID);
JMXConnector connector = myJMXConnections.get(nodeID);
if (isConnected(nodeID))
{
return connector;
}
LOG.info("Connection expired or disconnected with node Id {}", nodeID);
Node node = myNativeConnectionProvider.getNodes().get(nodeID);
try
{
LOG.info("Attempting to create JMX connection with node {}", node.getHostId());
myDistributedJmxBuilder.reconnect(node);
LOG.info("Connection created successfully with node {}", node.getHostId());
connector = myJMXConnections.get(nodeID);
}
catch (EcChronosException e)
{
LOG.error("Failed to connect to node {}: {}", node.getHostId(), e.getMessage());
}
return connector;
}

/**
Expand Down Expand Up @@ -144,7 +162,10 @@ public void close() throws IOException
@Override
public void close(final UUID nodeID) throws IOException
{
myJMXConnections.get(nodeID).close();
if (myJMXConnections.get(nodeID) != null)
{
myJMXConnections.get(nodeID).close();
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<module>fault.manager</module>
<module>fault.manager.impl</module>
<module>rest</module>
<module>standalone-integration</module>
</modules>

<properties>
Expand Down Expand Up @@ -463,6 +464,7 @@
<rulesets>
<ruleset>pmd-rules.xml</ruleset>
</rulesets>

<verbose>true</verbose>
</configuration>
</plugin>
Expand Down
170 changes: 170 additions & 0 deletions standalone-integration/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024 Telefonaktiebolaget LM Ericsson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>agent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>standalone-integration</artifactId>
<description>Integration tests for a standalone environment</description>
<name>EcChronos Standalone Integration</name>

<dependencies>
<!-- Internal -->
<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>connection</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>application</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>connection</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>connection.impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>cassandra-test-image</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>data</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ericsson.bss.cassandra.ecchronos</groupId>
<artifactId>core.impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>cassandra</artifactId>
<scope>test</scope>
</dependency>

<!-- SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<generatedSourcesDirectory>${project.build.directory}/generated-sources/</generatedSourcesDirectory>
</configuration>
</plugin>

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 34e58f7

Please sign in to comment.