Skip to content

Commit

Permalink
[improve][tests] Backwards compat tests: added new versions, pulsar u…
Browse files Browse the repository at this point in the history
…pgrade cases, read check from old server (apache#3981)

* Backwards compat tests: added new versions, pulsar upgrade cases, read check from old server
* upgrade tests with crc32c
* Fail integration tests if no tests found
  • Loading branch information
dlg99 authored and Anup Ghatage committed Jul 12, 2024
1 parent 03a9f20 commit 8214b2d
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bk-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -55,15 +56,27 @@ class TestCompatUpgrade {

try {
def ledger0 = currentRunningBK.createLedger(2, 2,
currentRunningCL.digestType("CRC32"),
PASSWD)
currentRunningCL.digestType(digestType),
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(digestType), 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)
def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType(digestType), PASSWD)
try {
ledger1.addEntry("foobar".getBytes())

Expand Down Expand Up @@ -91,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())
Expand Down Expand Up @@ -142,12 +155,55 @@ class TestCompatUpgrade {
}

@Test
public void test_006_4130to4143() throws Exception {
testUpgrade("4.13.0", "4.14.4")
public void test_006_4130to4148() throws Exception {
testUpgrade("4.13.0", "4.14.8")
}

@Test
public void test_007_4148to4155() throws Exception {
testUpgrade("4.14.8", "4.15.5")
}

@Test
public void test_007_4148to4155_crc32c() throws Exception {
testUpgrade("4.14.8", "4.15.5", "CRC32C")
}

@Test
public void test_008_4155to4165() throws Exception {
testUpgrade("4.15.5", "4.16.5")
}

@Test
public void test_008_4155to4165_crc32c() throws Exception {
testUpgrade("4.15.5", "4.16.5", "CRC32C")
}

@Test
public void test_007_4143toCurrentMaster() throws Exception {
testUpgrade("4.14.4", BookKeeperClusterUtils.CURRENT_VERSION)
public void test_008_4165to4170_crc32c() throws Exception {
testUpgrade("4.16.5", "4.17.0", "CRC32C")
}

@Test
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
@Test
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_4100to4170_crc32c() throws Exception {
testUpgrade("4.10.0", "4.17.0", "CRC32C")
}

}
5 changes: 4 additions & 1 deletion tests/docker-images/all-released-versions-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +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.4/bookkeeper-server-4.14.4-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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@
public class BookKeeperClusterUtils {
public static final String CURRENT_VERSION = System.getProperty("currentVersion");
public static final List<String> 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.8", "4.15.5", "4.16.5", "4.17.0");
private static final List<String> 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");


private static final List<String> 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.8", "4.15.5", "4.16.5", "4.17.0");

private static final Logger LOG = LoggerFactory.getLogger(BookKeeperClusterUtils.class);

Expand Down

0 comments on commit 8214b2d

Please sign in to comment.