@@ -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}
0 commit comments