Skip to content

Commit

Permalink
Cluster tests (#202)
Browse files Browse the repository at this point in the history
Recovery-testing module

Fix config of docker-compose plugin to support multiple modules.
  • Loading branch information
jendakol authored Mar 17, 2023
1 parent d9d1435 commit 8f66761
Show file tree
Hide file tree
Showing 10 changed files with 332 additions and 34 deletions.
72 changes: 38 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {
plugins {
id "io.github.gradle-nexus.publish-plugin" version '1.1.0'
}
apply plugin: 'docker-compose'

nexusPublishing {
repositories {
Expand Down Expand Up @@ -84,10 +83,13 @@ subprojects {
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.github.ben-manes.versions'

if (!project.hasProperty("notPublished")) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
}

task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier "sources"
Expand All @@ -100,45 +102,47 @@ subprojects {
withSourcesJar()
}

afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
artifactId = archivesBaseName
pom {
name = 'RabbitMQ client for Scala'
description = 'Scala wrapper over standard RabbitMQ Java client library'
url = 'https://github.com/avast/rabbitmq-scala-client'
licenses {
license {
name = 'The MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
if (!project.hasProperty("notPublished")) {
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
artifactId = archivesBaseName
pom {
name = 'RabbitMQ client for Scala'
description = 'Scala wrapper over standard RabbitMQ Java client library'
url = 'https://github.com/avast/rabbitmq-scala-client'
licenses {
license {
name = 'The MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
}
developers {
developer {
id = 'jendakol'
name = 'Jenda Kolena'
email = 'jan.kolena@avast.com'
developers {
developer {
id = 'jendakol'
name = 'Jenda Kolena'
email = 'jan.kolena@avast.com'
}
}
scm {
connection = 'scm:git:git://github.com/avast/rabbitmq-scala-client.git'
developerConnection = 'scm:git:ssh://github.com/avast/rabbitmq-scala-client.git'
url = 'https://github.com/avast/rabbitmq-scala-client'
}
}
scm {
connection = 'scm:git:git://github.com/avast/rabbitmq-scala-client.git'
developerConnection = 'scm:git:ssh://github.com/avast/rabbitmq-scala-client.git'
url = 'https://github.com/avast/rabbitmq-scala-client'
}
}
}
}
}
}

signing {
String base64Key = System.getenv('SIGNING_KEY')
if (base64Key) {
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
sign publishing.publications
signing {
String base64Key = System.getenv('SIGNING_KEY')
if (base64Key) {
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
sign publishing.publications
}
}
}

Expand Down
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apply plugin: 'docker-compose'
apply plugin: 'com.google.protobuf'

archivesBaseName = "rabbitmq-client-core_$scalaVersion"
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions recovery-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apply plugin: 'docker-compose'

archivesBaseName = "rabbitmq-client-core_$scalaVersion"

dockerCompose.isRequiredBy(test)

test.doFirst {
dockerCompose.exposeAsSystemProperties(test)
}

dependencies {
api project(":pureconfig")

api "com.spotify:docker-client:8.14.1"
}
34 changes: 34 additions & 0 deletions recovery-testing/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3"
services:
cluster_rabbit1:
image: lucifer8591/rabbitmq-server:3.7.17
hostname: cluster_rabbit1
ports:
- "20001:5672"
- "15672:15672"
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-admin}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-admin}
cluster_rabbit2:
image: lucifer8591/rabbitmq-server:3.7.17
hostname: cluster_rabbit2
links:
- cluster_rabbit1
environment:
- CLUSTERED=true
- CLUSTER_WITH=cluster_rabbit1
- RAM_NODE=true
ports:
- "20002:5672"
- "15673:15672"
cluster_rabbit3:
image: lucifer8591/rabbitmq-server:3.7.17
hostname: cluster_rabbit3
links:
- cluster_rabbit1
- cluster_rabbit2
environment:
- CLUSTERED=true
- CLUSTER_WITH=cluster_rabbit1
ports:
- "20003:5672"
1 change: 1 addition & 0 deletions recovery-testing/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
notPublished=true
57 changes: 57 additions & 0 deletions recovery-testing/src/test/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
recoveryTesting {
hosts = ["127.0.0.1:20001", "127.0.0.1:20002", "127.0.0.1:20003"] // the order is irrelevant
virtualHost = "/"

name = "TestingConnection"

credentials {
enabled = true

username = "admin"
password = "admin"
}

connectionTimeout = 1s

networkRecovery {
enabled = true // enabled by default

handler {
type = "exponential" // exponential, linear

initialDelay = 10s
period = 2s
maxLength = 32s
}
}


consumers {
consumer {
name = "TestingConsumer"

queueName = "RecoveryTesting"

prefetchCount = 5
processTimeout = 0

declare {
enabled = true

durable = true
autoDelete = false
exclusive = false
}

bindings = []
}
}

producers {
producer {
name = "TestingProducer"
exchange = ""
}
}

}
Loading

0 comments on commit 8f66761

Please sign in to comment.