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 9, 2024
1 parent c2ca685 commit 05655d2
Show file tree
Hide file tree
Showing 12 changed files with 1,467 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
distribution: 'temurin'
- name: install dependencies
run: mvn install -DskipTests=true
- name: Set Maven Profile
run: mvn -Pbuild-cassandra-test-jar clean install
- run: mvn $TEST_SUITE -B
id: tests
env:
Expand Down
Empty file added 7199
Empty file.
7 changes: 7 additions & 0 deletions cassandra-test-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 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
234 changes: 234 additions & 0 deletions standalone-integration/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2018 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>

<profiles>
<profile>
<activation>
<property>
<name>precommit.tests</name>
</property>
</activation>
<id>standalone-integration-tests</id>
<build>
<plugins>
<!-- Integration tests -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Docker -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<activation>
<property>
<name>localprecommit.tests</name>
</property>
</activation>
<id>local-standalone-integration-tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<it-cassandra.ip>127.0.0.1</it-cassandra.ip>
<it-cassandra.jmx.port>7100</it-cassandra.jmx.port>
<it-cassandra.native.port>9042</it-cassandra.native.port>
<it-local-cassandra>true</it-local-cassandra>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<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 05655d2

Please sign in to comment.