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

Add spotless check for groovy tests #4471

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bk-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
if: steps.check_changes.outputs.docs_only != 'true'
run: |
mvn -T 1C -B -nsu clean install -Ddistributedlog -DskipTests
mvn -T 1C -B -nsu apache-rat:check checkstyle:check spotbugs:check package -Ddistributedlog -DskipTests
mvn -T 1C -B -nsu apache-rat:check checkstyle:check spotbugs:check spotless:check package -Ddistributedlog -DskipTests

- name: Check license files
if: steps.check_changes.outputs.docs_only != 'true'
Expand Down
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
<slf4j.version>2.0.12</slf4j.version>
<snakeyaml.version>2.0</snakeyaml.version>
<spotbugs-annotations.version>4.6.0</spotbugs-annotations.version>
<spotless.version>2.43.0</spotless.version>
<javax-annotations-api.version>1.3.2</javax-annotations-api.version>
<testcontainers.version>1.19.4</testcontainers.version>
<vertx.version>4.5.7</vertx.version>
Expand Down Expand Up @@ -1140,6 +1141,21 @@
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<groovy>
<includes>
<include>src/main/groovy/**/*.groovy</include>
<include>src/test/groovy/**/*.groovy</include>
</includes>
<importOrder/>
<removeSemicolons/>
</groovy>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ abstract class AbstractClientFencingTest {
}
ledger2.close()
} catch(Throwable tt) {
throw new RuntimeException("Got exception with oldClientVersion: " + oldClientVersion + " and fencingVersion: " + fencingVersion, tt);
throw new RuntimeException("Got exception with oldClientVersion: " + oldClientVersion + " and fencingVersion: " + fencingVersion, tt)
} finally {
oldBK.close()
oldCL.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader
import org.apache.bookkeeper.tests.integration.utils.ThreadReaper

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -108,11 +105,11 @@ class TestCompatOldClients {
try {
def ledger1 = readBK.openLedger(ledger0.getId(), readCL.digestType("CRC32"), PASSWD)
if (expectFail) {
Assert.fail("For older versions Openledger call is expected to fail with ZKException, writerVersion: " + writeVersion + ", readerVersion: " + readerVersion);
Assert.fail("For older versions Openledger call is expected to fail with ZKException, writerVersion: " + writeVersion + ", readerVersion: " + readerVersion)
}
} catch (Exception exc) {
if (!expectFail) {
Assert.fail("For older versions Openledger call is expected to work, writerVersion: " + writeVersion + ", readerVersion: " + readerVersion);
Assert.fail("For older versions Openledger call is expected to work, writerVersion: " + writeVersion + ", readerVersion: " + readerVersion)
}
Assert.assertEquals(exc.getClass().getName(),
"org.apache.bookkeeper.client.BKException\$ZKException")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,28 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import io.netty.buffer.ByteBuf
import org.apache.bookkeeper.net.BookieId

import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicLong

import org.apache.bookkeeper.client.BKException
import org.apache.bookkeeper.client.BookKeeper
import org.apache.bookkeeper.client.BookKeeperAdmin
import org.apache.bookkeeper.client.LedgerHandle
import org.apache.bookkeeper.client.api.LedgerMetadata
import org.apache.bookkeeper.conf.ClientConfiguration
import org.apache.bookkeeper.net.BookieId
import org.apache.bookkeeper.net.BookieSocketAddress
import org.apache.bookkeeper.proto.BookieProtocol
import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.ReadEntryCallback
import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.DockerUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand All @@ -62,8 +56,8 @@ class TestCompatRecoveryNoPassword {
}

private static class ReplicationVerificationCallback implements ReadEntryCallback {
final CountDownLatch latch;
final AtomicLong numSuccess;
final CountDownLatch latch
final AtomicLong numSuccess

ReplicationVerificationCallback(int numRequests) {
latch = new CountDownLatch(numRequests)
Expand All @@ -84,10 +78,10 @@ class TestCompatRecoveryNoPassword {

long await() throws InterruptedException {
if (!latch.await(60, TimeUnit.SECONDS)) {
LOG.warn("Didn't get all responses in verification");
return 0;
LOG.warn("Didn't get all responses in verification")
return 0
} else {
return numSuccess.get();
return numSuccess.get()
}
}
}
Expand Down Expand Up @@ -122,15 +116,15 @@ class TestCompatRecoveryNoPassword {
}
}

long numSuccess = cb.await();
long numSuccess = cb.await()
if (numSuccess < expectedSuccess) {
LOG.warn("Fragment not fully replicated ledgerId = {} startEntryId = {}"
+ " endEntryId = {} expectedSuccess = {} gotSuccess = {}",
lh.getId(), startEntryId, endEntryId, expectedSuccess, numSuccess);
return false;
lh.getId(), startEntryId, endEntryId, expectedSuccess, numSuccess)
return false
}
}
return true;
return true
}

/**
Expand Down Expand Up @@ -203,7 +197,7 @@ class TestCompatRecoveryNoPassword {
} catch (BKException bke) {
// correct behaviour
} finally {
bka.close();
bka.close()
}

adminConf.setBookieRecoveryDigestType(BookKeeper.DigestType.CRC32)
Expand All @@ -216,7 +210,7 @@ class TestCompatRecoveryNoPassword {
} catch (BKException bke) {
// correct behaviour
} finally {
bka.close();
bka.close()
}

// Check that entries are still missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient
import java.util.concurrent.TimeUnit
import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader
import org.jboss.arquillian.junit.Arquillian
Expand All @@ -32,8 +33,6 @@ import org.junit.runners.MethodSorters
import org.slf4j.Logger
import org.slf4j.LoggerFactory

import java.util.concurrent.TimeUnit

/**
* Sequentially upgrade bookies with different versions and check compatibility.
* Uses DbLedgerStorage/RocksDB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@
package org.apache.bookkeeper.tests.backwardcompat

import com.github.dockerjava.api.DockerClient

import org.apache.bookkeeper.tests.integration.utils.BookKeeperClusterUtils
import org.apache.bookkeeper.tests.integration.utils.MavenClassLoader

import org.jboss.arquillian.junit.Arquillian
import org.jboss.arquillian.test.api.ArquillianResource

import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters

import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down Expand Up @@ -85,7 +81,7 @@ class TestCompatUpgrade {
}
} catch (Exception e) {
if (!clientCompatBroken) {
throw e;
throw e
}
}

Expand Down
Loading