Skip to content

Commit 9656202

Browse files
authored
[improve][tests] Backwards compat tests: added new versions, pulsar upgrade cases, read check from old server (#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
1 parent 896137d commit 9656202

File tree

4 files changed

+76
-20
lines changed

4 files changed

+76
-20
lines changed

.github/workflows/bk-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ jobs:
326326
run: mvn -B -nsu clean install -Pdocker -DskipTests
327327

328328
- name: Test current server with old clients
329-
run: mvn -B -nsu -DbackwardCompatTests -pl :backward-compat-current-server-old-clients test
329+
run: mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :backward-compat-current-server-old-clients test
330330

331331
- name: Test progressive upgrade
332-
run: mvn -B -nsu -DbackwardCompatTests -pl :upgrade test
332+
run: mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :upgrade test
333333

334334
- name: Other tests
335335
run: |
336-
mvn -B -nsu -DbackwardCompatTests -pl :bc-non-fips,:hierarchical-ledger-manager,:hostname-bookieid,:old-cookie-new-cluster,:recovery-no-password,:upgrade-direct test
336+
mvn -B -nsu -DbackwardCompatTests -DfailIfNoTests -pl :bc-non-fips,:hierarchical-ledger-manager,:hostname-bookieid,:old-cookie-new-cluster,:recovery-no-password,:upgrade-direct test
337337
338338
- name: Upload container logs on failure
339339
uses: actions/upload-artifact@v4

tests/backward-compat/upgrade/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgrade.groovy

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class TestCompatUpgrade {
4343
@ArquillianResource
4444
DockerClient docker
4545

46-
private void testUpgrade(String currentlyRunning, String upgradeTo, boolean clientCompatBroken = false,
46+
private void testUpgrade(String currentlyRunning, String upgradeTo, String digestType = "CRC32",
47+
boolean clientCompatBroken = false,
4748
boolean currentlyRunningShutsdownBadly = false) {
4849
String zookeeper = BookKeeperClusterUtils.zookeeperConnectString(docker)
4950
LOG.info("Upgrading from {} to {}", currentlyRunning, upgradeTo)
@@ -55,15 +56,27 @@ class TestCompatUpgrade {
5556

5657
try {
5758
def ledger0 = currentRunningBK.createLedger(2, 2,
58-
currentRunningCL.digestType("CRC32"),
59-
PASSWD)
59+
currentRunningCL.digestType(digestType),
60+
PASSWD)
6061
for (int i = 0; i < numEntries; i++) {
6162
ledger0.addEntry(("foobar" + i).getBytes())
6263
}
6364
ledger0.close()
6465

66+
// Check whether current client can read from old server
67+
def ledger0ro = upgradedBK.openLedger(ledger0.getId(), upgradedCL.digestType(digestType), PASSWD)
68+
def entries0 = ledger0ro.readEntries(0, numEntries - 1)
69+
int jj = 0
70+
while (entries0.hasMoreElements()) {
71+
def e = entries0.nextElement()
72+
Assert.assertEquals(new String(e.getEntry()), "foobar" + jj)
73+
jj++
74+
}
75+
Assert.assertEquals(jj, numEntries)
76+
ledger0ro.close()
77+
6578
// Check whether current client can write to old server
66-
def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType("CRC32"), PASSWD)
79+
def ledger1 = upgradedBK.createLedger(2, 2, upgradedCL.digestType(digestType), PASSWD)
6780
try {
6881
ledger1.addEntry("foobar".getBytes())
6982

@@ -91,7 +104,7 @@ class TestCompatUpgrade {
91104
Assert.assertTrue(BookKeeperClusterUtils.startAllBookiesWithVersion(docker, upgradeTo))
92105

93106
// check that old client can read its old ledgers on new server
94-
def ledger2 = currentRunningBK.openLedger(ledger0.getId(), currentRunningCL.digestType("CRC32"),
107+
def ledger2 = currentRunningBK.openLedger(ledger0.getId(), currentRunningCL.digestType(digestType),
95108
PASSWD)
96109
Assert.assertEquals(numEntries, ledger2.getLastAddConfirmed() + 1 /* counts from 0 */)
97110
def entries = ledger2.readEntries(0, ledger2.getLastAddConfirmed())
@@ -142,12 +155,55 @@ class TestCompatUpgrade {
142155
}
143156

144157
@Test
145-
public void test_006_4130to4143() throws Exception {
146-
testUpgrade("4.13.0", "4.14.4")
158+
public void test_006_4130to4148() throws Exception {
159+
testUpgrade("4.13.0", "4.14.8")
160+
}
161+
162+
@Test
163+
public void test_007_4148to4155() throws Exception {
164+
testUpgrade("4.14.8", "4.15.5")
165+
}
166+
167+
@Test
168+
public void test_007_4148to4155_crc32c() throws Exception {
169+
testUpgrade("4.14.8", "4.15.5", "CRC32C")
170+
}
171+
172+
@Test
173+
public void test_008_4155to4165() throws Exception {
174+
testUpgrade("4.15.5", "4.16.5")
175+
}
176+
177+
@Test
178+
public void test_008_4155to4165_crc32c() throws Exception {
179+
testUpgrade("4.15.5", "4.16.5", "CRC32C")
147180
}
148181

149182
@Test
150-
public void test_007_4143toCurrentMaster() throws Exception {
151-
testUpgrade("4.14.4", BookKeeperClusterUtils.CURRENT_VERSION)
183+
public void test_008_4165to4170_crc32c() throws Exception {
184+
testUpgrade("4.16.5", "4.17.0", "CRC32C")
152185
}
186+
187+
@Test
188+
public void test_009_4165toCurrentMaster() throws Exception {
189+
testUpgrade("4.17.0", BookKeeperClusterUtils.CURRENT_VERSION)
190+
}
191+
192+
@Test
193+
public void test_009_4165toCurrentMaster_crc32c() throws Exception {
194+
testUpgrade("4.17.0", BookKeeperClusterUtils.CURRENT_VERSION, "CRC32C")
195+
}
196+
197+
// old version pulsar upgrade tests
198+
@Test
199+
public void test_010_4100to4148_crc32c() throws Exception {
200+
testUpgrade("4.10.0", "4.14.8", "CRC32C")
201+
}
202+
203+
// old version pulsar upgrade tests
204+
@Test
205+
public void test_010_4100to4170_crc32c() throws Exception {
206+
testUpgrade("4.10.0", "4.17.0", "CRC32C")
207+
}
208+
153209
}

tests/docker-images/all-released-versions-image/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.10.0/bookke
4949
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.11.1/bookkeeper-server-4.11.1-bin.tar.gz{,.sha512,.asc}
5050
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.12.1/bookkeeper-server-4.12.1-bin.tar.gz{,.sha512,.asc}
5151
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.13.0/bookkeeper-server-4.13.0-bin.tar.gz{,.sha512,.asc}
52-
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.4/bookkeeper-server-4.14.4-bin.tar.gz{,.sha512,.asc}
52+
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.14.8/bookkeeper-server-4.14.8-bin.tar.gz{,.sha512,.asc}
53+
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.15.5/bookkeeper-server-4.15.5-bin.tar.gz{,.sha512,.asc}
54+
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.16.5/bookkeeper-server-4.16.5-bin.tar.gz{,.sha512,.asc}
55+
RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.17.0/bookkeeper-server-4.17.0-bin.tar.gz{,.sha512,.asc}
5356

5457
RUN wget -nv https://dist.apache.org/repos/dist/release/bookkeeper/KEYS
5558
RUN wget -nv http://svn.apache.org/repos/asf/zookeeper/bookkeeper/dist/KEYS?p=1620552 -O KEYS.old

tests/integration-tests-utils/src/main/java/org/apache/bookkeeper/tests/integration/utils/BookKeeperClusterUtils.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@
4040
public class BookKeeperClusterUtils {
4141
public static final String CURRENT_VERSION = System.getProperty("currentVersion");
4242
public static final List<String> OLD_CLIENT_VERSIONS =
43-
Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.4");
43+
Arrays.asList("4.8.2", "4.9.2", "4.10.0", "4.11.1", "4.12.1",
44+
"4.13.0", "4.14.8", "4.15.5", "4.16.5", "4.17.0");
4445
private static final List<String> OLD_CLIENT_VERSIONS_WITH_CURRENT_LEDGER_METADATA_FORMAT =
45-
Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.4");
46-
47-
48-
private static final List<String> OLD_CLIENT_VERSIONS_WITH_OLD_BK_BIN_NAME =
49-
Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1", "4.13.0", "4.14.3", "4.3-yahoo");
50-
46+
Arrays.asList("4.9.2", "4.10.0", "4.11.1", "4.12.1",
47+
"4.13.0", "4.14.8", "4.15.5", "4.16.5", "4.17.0");
5148

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

0 commit comments

Comments
 (0)