From 37d7279ff1e22d64213f9d65039b6170861c2520 Mon Sep 17 00:00:00 2001 From: Andrey Yegorov Date: Tue, 6 Jun 2023 11:40:38 -0700 Subject: [PATCH 1/4] Backwards compat tests: added new versions, pulsar upgrade cases, read check from old server --- .../backwardcompat/TestCompatUpgrade.groovy | 47 ++++++++++++++++--- .../all-released-versions-image/Dockerfile | 4 +- .../utils/BookKeeperClusterUtils.java | 6 +-- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy index e7e9a3170a3..317d86034bd 100644 --- a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy +++ b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy @@ -55,13 +55,25 @@ class TestCompatUpgrade { try { def ledger0 = currentRunningBK.createLedger(2, 2, - currentRunningCL.digestType("CRC32"), - PASSWD) + currentRunningCL.digestType("CRC32"), + PASSWD) for (int i = 0; i < numEntries; i++) { ledger0.addEntry(("foobar" + i).getBytes()) } ledger0.close() + // Check whether current client can read from old server + def ledger0ro = upgradedBK.openLedger(ledger0.getId(), upgradedCL.digestType("CRC32"), PASSWD) + def entries0 = ledger0ro.readEntries(0, numEntries - 1) + int jj = 0 + while (entries0.hasMoreElements()) { + def e = entries0.nextElement() + Assert.assertEquals(new String(e.getEntry()), "foobar" + jj) + jj++ + } + Assert.assertEquals(jj, numEntries) + ledger0ro.close() + // Check whether current client can write to old server def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType("CRC32"), PASSWD) try { @@ -142,12 +154,35 @@ class TestCompatUpgrade { } @Test - public void test_006_4130to4143() throws Exception { - testUpgrade("4.13.0", "4.14.4") + public void test_006_4130to4147() throws Exception { + testUpgrade("4.13.0", "4.14.7") + } + + @Test + public void test_007_4147to4154() throws Exception { + testUpgrade("4.14.7", "4.15.4") + } + + @Test + public void test_008_4154to4161() throws Exception { + testUpgrade("4.15.4", "4.16.1") } @Test - public void test_007_4143toCurrentMaster() throws Exception { - testUpgrade("4.14.4", BookKeeperClusterUtils.CURRENT_VERSION) + public void test_009_4161toCurrentMaster() throws Exception { + testUpgrade("4.16.1", BookKeeperClusterUtils.CURRENT_VERSION) } + + // old version pulsar upgrade tests + @Test + public void test_010_4100to4147() throws Exception { + testUpgrade("4.10.0", "4.14.7") + } + + // old version pulsar upgrade tests + @Test + public void test_010_4100to4161() throws Exception { + testUpgrade("4.10.0", "4.16.1") + } + } diff --git a/tests/docker-images/all-released-versions-image/Dockerfile b/tests/docker-images/all-released-versions-image/Dockerfile index a8c761c7e88..0096bdba69c 100644 --- a/tests/docker-images/all-released-versions-image/Dockerfile +++ b/tests/docker-images/all-released-versions-image/Dockerfile @@ -49,7 +49,9 @@ RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.10.0/bookke RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.11.1/bookkeeper-server-4.11.1-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.12.1/bookkeeper-server-4.12.1-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.13.0/bookkeeper-server-4.13.0-bin.tar.gz{,.sha512,.asc} -RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.4/bookkeeper-server-4.14.4-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.7/bookkeeper-server-4.14.7-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.15.4/bookkeeper-server-4.15.4-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.16.1/bookkeeper-server-4.16.1-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://dist.apache.org/repos/dist/release/bookkeeper/KEYS RUN wget -nv http://svn.apache.org/repos/asf/zookeeper/bookkeeper/dist/KEYS?p=1620552 -O KEYS.old diff --git a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java index 1e5044999a1..1a1ceb33e37 100644 --- a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java +++ b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java @@ -40,13 +40,13 @@ public class BookKeeperClusterUtils { public static final String CURRENT_VERSION = System.getProperty("currentVersion"); public static final List OLD_CLIENT_VERSIONS = - Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.4"); + Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1"); private static final List OLD_CLIENT_VERSIONS_WITH_CURRENT_LEDGER_METADATA_FORMAT = - Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.4"); + Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1"); private static final List OLD_CLIENT_VERSIONS_WITH_OLD_BK_BIN_NAME = - Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.3", "4.3-yahoo"); + Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1", "4.3-yahoo"); private static final Logger LOG = LoggerFactory.getLogger(BookKeeperClusterUtils.class); From 6c209351a573b9baf35e4d7e6e14c8c35702e7d5 Mon Sep 17 00:00:00 2001 From: Andrey Yegorov Date: Tue, 6 Jun 2023 12:03:39 -0700 Subject: [PATCH 2/4] upgrade tests with crc32c --- .../backwardcompat/TestCompatUpgrade.groovy | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy index 317d86034bd..de54db308ce 100644 --- a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy +++ b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy @@ -43,7 +43,8 @@ class TestCompatUpgrade { @ArquillianResource DockerClient docker - private void testUpgrade(String currentlyRunning, String upgradeTo, boolean clientCompatBroken = false, + private void testUpgrade(String currentlyRunning, String upgradeTo, String digestType = "CRC32", + boolean clientCompatBroken = false, boolean currentlyRunningShutsdownBadly = false) { String zookeeper = BookKeeperClusterUtils.zookeeperConnectString(docker) LOG.info("Upgrading from {} to {}", currentlyRunning, upgradeTo) @@ -55,7 +56,7 @@ class TestCompatUpgrade { try { def ledger0 = currentRunningBK.createLedger(2, 2, - currentRunningCL.digestType("CRC32"), + currentRunningCL.digestType(digestType), PASSWD) for (int i = 0; i < numEntries; i++) { ledger0.addEntry(("foobar" + i).getBytes()) @@ -63,7 +64,7 @@ class TestCompatUpgrade { ledger0.close() // Check whether current client can read from old server - def ledger0ro = upgradedBK.openLedger(ledger0.getId(), upgradedCL.digestType("CRC32"), PASSWD) + def ledger0ro = upgradedBK.openLedger(ledger0.getId(), upgradedCL.digestType(digestType), PASSWD) def entries0 = ledger0ro.readEntries(0, numEntries - 1) int jj = 0 while (entries0.hasMoreElements()) { @@ -75,7 +76,7 @@ class TestCompatUpgrade { ledger0ro.close() // Check whether current client can write to old server - def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType("CRC32"), PASSWD) + def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType(digestType), PASSWD) try { ledger1.addEntry("foobar".getBytes()) @@ -103,7 +104,7 @@ class TestCompatUpgrade { Assert.assertTrue(BookKeeperClusterUtils.startAllBookiesWithVersion(docker, upgradeTo)) // check that old client can read its old ledgers on new server - def ledger2 = currentRunningBK.openLedger(ledger0.getId(), currentRunningCL.digestType("CRC32"), + def ledger2 = currentRunningBK.openLedger(ledger0.getId(), currentRunningCL.digestType(digestType), PASSWD) Assert.assertEquals(numEntries, ledger2.getLastAddConfirmed() + 1 /* counts from 0 */) def entries = ledger2.readEntries(0, ledger2.getLastAddConfirmed()) @@ -163,26 +164,42 @@ class TestCompatUpgrade { testUpgrade("4.14.7", "4.15.4") } + @Test + public void test_007_4147to4154_crc32c() throws Exception { + testUpgrade("4.14.7", "4.15.4", "CRC32C") + } + @Test public void test_008_4154to4161() throws Exception { testUpgrade("4.15.4", "4.16.1") } + @Test + public void test_008_4154to4161_crc32c() throws Exception { + testUpgrade("4.15.4", "4.16.1", "CRC32C") + } + @Test public void test_009_4161toCurrentMaster() throws Exception { testUpgrade("4.16.1", BookKeeperClusterUtils.CURRENT_VERSION) } + @Test + public void test_009_4161toCurrentMaster_crc32c() throws Exception { + testUpgrade("4.16.1", BookKeeperClusterUtils.CURRENT_VERSION, "CRC32C") + } + + // old version pulsar upgrade tests // old version pulsar upgrade tests @Test - public void test_010_4100to4147() throws Exception { - testUpgrade("4.10.0", "4.14.7") + public void test_010_4100to4147_crc32c() throws Exception { + testUpgrade("4.10.0", "4.14.7", "CRC32C") } // old version pulsar upgrade tests @Test - public void test_010_4100to4161() throws Exception { - testUpgrade("4.10.0", "4.16.1") + public void test_010_4100to4161_crc32c() throws Exception { + testUpgrade("4.10.0", "4.16.1", "CRC32C") } } From 7dd0fe3db40a7b2a300394f35e1543ac0ec8b429 Mon Sep 17 00:00:00 2001 From: Andrey Yegorov Date: Tue, 6 Jun 2023 15:25:16 -0700 Subject: [PATCH 3/4] Fail integration tests if no tests found --- .github/workflows/bk-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bk-ci.yml b/.github/workflows/bk-ci.yml index 9d37b87692e..2a3a459c516 100644 --- a/.github/workflows/bk-ci.yml +++ b/.github/workflows/bk-ci.yml @@ -326,14 +326,14 @@ jobs: run: mvn -B -nsu clean install -Pdocker -DskipTests - name: Test current server with old clients - run: mvn -B -nsu -DbackwardCompatTests -pl :backward-compat-current-server-old-clients test + run: mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :backward-compat-current-server-old-clients test - name: Test progressive upgrade - run: mvn -B -nsu -DbackwardCompatTests -pl :upgrade test + run: mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :upgrade test - name: Other tests run: | - mvn -B -nsu -DbackwardCompatTests -pl :bc-non-fips,:hierarchical-ledger-manager,:hostname-bookieid,:old-cookie-new-cluster,:recovery-no-password,:upgrade-direct test + mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :bc-non-fips,:hierarchical-ledger-manager,:hostname-bookieid,:old-cookie-new-cluster,:recovery-no-password,:upgrade-direct test - name: Upload container logs on failure uses: actions/upload-artifact@v4 From 62e3ee091af6ced99db994be28597cc12f277e65 Mon Sep 17 00:00:00 2001 From: Andrey Yegorov Date: Wed, 5 Jun 2024 11:49:04 -0700 Subject: [PATCH 4/4] versions update --- .../backwardcompat/TestCompatUpgrade.groovy | 42 ++++++++++--------- .../all-released-versions-image/Dockerfile | 7 ++-- .../utils/BookKeeperClusterUtils.java | 11 ++--- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy index de54db308ce..a79d6b8752a 100644 --- a/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy +++ b/tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy @@ -155,51 +155,55 @@ class TestCompatUpgrade { } @Test - public void test_006_4130to4147() throws Exception { - testUpgrade("4.13.0", "4.14.7") + public void test_006_4130to4148() throws Exception { + testUpgrade("4.13.0", "4.14.8") } @Test - public void test_007_4147to4154() throws Exception { - testUpgrade("4.14.7", "4.15.4") + public void test_007_4148to4155() throws Exception { + testUpgrade("4.14.8", "4.15.5") } @Test - public void test_007_4147to4154_crc32c() throws Exception { - testUpgrade("4.14.7", "4.15.4", "CRC32C") + public void test_007_4148to4155_crc32c() throws Exception { + testUpgrade("4.14.8", "4.15.5", "CRC32C") } @Test - public void test_008_4154to4161() throws Exception { - testUpgrade("4.15.4", "4.16.1") + public void test_008_4155to4165() throws Exception { + testUpgrade("4.15.5", "4.16.5") } @Test - public void test_008_4154to4161_crc32c() throws Exception { - testUpgrade("4.15.4", "4.16.1", "CRC32C") + public void test_008_4155to4165_crc32c() throws Exception { + testUpgrade("4.15.5", "4.16.5", "CRC32C") } @Test - public void test_009_4161toCurrentMaster() throws Exception { - testUpgrade("4.16.1", BookKeeperClusterUtils.CURRENT_VERSION) + public void test_008_4165to4170_crc32c() throws Exception { + testUpgrade("4.16.5", "4.17.0", "CRC32C") } @Test - public void test_009_4161toCurrentMaster_crc32c() throws Exception { - testUpgrade("4.16.1", BookKeeperClusterUtils.CURRENT_VERSION, "CRC32C") + public void test_009_4165toCurrentMaster() throws Exception { + testUpgrade("4.17.0", BookKeeperClusterUtils.CURRENT_VERSION) + } + + @Test + public void test_009_4165toCurrentMaster_crc32c() throws Exception { + testUpgrade("4.17.0", BookKeeperClusterUtils.CURRENT_VERSION, "CRC32C") } - // old version pulsar upgrade tests // old version pulsar upgrade tests @Test - public void test_010_4100to4147_crc32c() throws Exception { - testUpgrade("4.10.0", "4.14.7", "CRC32C") + public void test_010_4100to4148_crc32c() throws Exception { + testUpgrade("4.10.0", "4.14.8", "CRC32C") } // old version pulsar upgrade tests @Test - public void test_010_4100to4161_crc32c() throws Exception { - testUpgrade("4.10.0", "4.16.1", "CRC32C") + public void test_010_4100to4170_crc32c() throws Exception { + testUpgrade("4.10.0", "4.17.0", "CRC32C") } } diff --git a/tests/docker-images/all-released-versions-image/Dockerfile b/tests/docker-images/all-released-versions-image/Dockerfile index 0096bdba69c..b38315524b3 100644 --- a/tests/docker-images/all-released-versions-image/Dockerfile +++ b/tests/docker-images/all-released-versions-image/Dockerfile @@ -49,9 +49,10 @@ RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.10.0/bookke RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.11.1/bookkeeper-server-4.11.1-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.12.1/bookkeeper-server-4.12.1-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.13.0/bookkeeper-server-4.13.0-bin.tar.gz{,.sha512,.asc} -RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.7/bookkeeper-server-4.14.7-bin.tar.gz{,.sha512,.asc} -RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.15.4/bookkeeper-server-4.15.4-bin.tar.gz{,.sha512,.asc} -RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.16.1/bookkeeper-server-4.16.1-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.8/bookkeeper-server-4.14.8-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.15.5/bookkeeper-server-4.15.5-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.16.5/bookkeeper-server-4.16.5-bin.tar.gz{,.sha512,.asc} +RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.17.0/bookkeeper-server-4.17.0-bin.tar.gz{,.sha512,.asc} RUN wget -nv https://dist.apache.org/repos/dist/release/bookkeeper/KEYS RUN wget -nv http://svn.apache.org/repos/asf/zookeeper/bookkeeper/dist/KEYS?p=1620552 -O KEYS.old diff --git a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java index 1a1ceb33e37..34e3a65e5e6 100644 --- a/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java +++ b/tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java @@ -40,14 +40,11 @@ public class BookKeeperClusterUtils { public static final String CURRENT_VERSION = System.getProperty("currentVersion"); public static final List OLD_CLIENT_VERSIONS = - Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1"); + Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1", + "4.13.0", "4.14.8", "4.15.5", "4.16.5", "4.17.0"); private static final List OLD_CLIENT_VERSIONS_WITH_CURRENT_LEDGER_METADATA_FORMAT = - Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1"); - - - private static final List OLD_CLIENT_VERSIONS_WITH_OLD_BK_BIN_NAME = - Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.7", "4.15.4", "4.16.1", "4.3-yahoo"); - + Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", + "4.13.0", "4.14.8", "4.15.5", "4.16.5", "4.17.0"); private static final Logger LOG = LoggerFactory.getLogger(BookKeeperClusterUtils.class);