@@ -12,20 +12,18 @@ use mz_persist_client::PersistLocation;
1212use mz_persist_client:: cache:: PersistClientCache ;
1313use uuid:: Uuid ;
1414
15- use crate :: durable:: persist:: {
16- CATALOG_SEED , UPGRADE_SEED , fetch_catalog_upgrade_shard_version, shard_id,
17- } ;
15+ use crate :: durable:: persist:: { UPGRADE_SEED , fetch_catalog_upgrade_shard_version, shard_id} ;
1816use crate :: durable:: { DurableCatalogError , TestCatalogStateBuilder , test_bootstrap_args} ;
1917
2018/// Test that the catalog forces users to upgrade one version at a time.
2119#[ mz_ore:: test( tokio:: test) ]
2220#[ cfg_attr( miri, ignore) ] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
2321async fn test_upgrade_shard ( ) {
24- let first_version = semver:: Version :: parse ( "0.10 .0" ) . expect ( "failed to parse version" ) ;
25- let second_version = semver:: Version :: parse ( "0.11 .0" ) . expect ( "failed to parse version" ) ;
22+ let first_version = semver:: Version :: parse ( "0.147 .0" ) . expect ( "failed to parse version" ) ;
23+ let second_version = semver:: Version :: parse ( "26.0 .0" ) . expect ( "failed to parse version" ) ;
2624 let second_dev_version =
27- semver:: Version :: parse ( "0.11 .0-dev.0" ) . expect ( "failed to parse version" ) ;
28- let third_version = semver:: Version :: parse ( "0.12 .0" ) . expect ( "failed to parse version" ) ;
25+ semver:: Version :: parse ( "26.0 .0-dev.0" ) . expect ( "failed to parse version" ) ;
26+ let third_version = semver:: Version :: parse ( "27.1 .0" ) . expect ( "failed to parse version" ) ;
2927 let organization_id = Uuid :: new_v4 ( ) ;
3028 let deploy_generation = 0 ;
3129 let mut persist_cache = PersistClientCache :: new_no_metrics ( ) ;
@@ -156,12 +154,12 @@ async fn test_upgrade_shard() {
156154#[ mz_ore:: test( tokio:: test) ]
157155#[ cfg_attr( miri, ignore) ] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
158156async fn test_version_regression ( ) {
159- let first_version = semver:: Version :: parse ( "0.10 .0" ) . expect ( "failed to parse version" ) ;
160- let second_version = semver:: Version :: parse ( "0.11 .0" ) . expect ( "failed to parse version" ) ;
157+ let first_version = semver:: Version :: parse ( "0.147 .0" ) . expect ( "failed to parse version" ) ;
158+ let second_version = semver:: Version :: parse ( "26.1 .0" ) . expect ( "failed to parse version" ) ;
161159 let organization_id = Uuid :: new_v4 ( ) ;
162160 let deploy_generation = 0 ;
163161 let mut persist_cache = PersistClientCache :: new_no_metrics ( ) ;
164- let catalog_shard_id = shard_id ( organization_id, CATALOG_SEED ) ;
162+ let upgrade_shard_id = shard_id ( organization_id, UPGRADE_SEED ) ;
165163
166164 persist_cache. cfg . build_version = first_version. clone ( ) ;
167165 let persist_client = persist_cache
@@ -171,7 +169,7 @@ async fn test_version_regression() {
171169
172170 assert_eq ! (
173171 None ,
174- fetch_catalog_upgrade_shard_version( & persist_client, catalog_shard_id ) . await
172+ fetch_catalog_upgrade_shard_version( & persist_client, upgrade_shard_id ) . await
175173 ) ;
176174
177175 let persist_openable_state = TestCatalogStateBuilder :: new ( persist_client. clone ( ) )
@@ -188,7 +186,7 @@ async fn test_version_regression() {
188186
189187 assert_eq ! (
190188 Some ( first_version. clone( ) ) ,
191- fetch_catalog_upgrade_shard_version( & persist_client, catalog_shard_id ) . await
189+ fetch_catalog_upgrade_shard_version( & persist_client, upgrade_shard_id ) . await
192190 ) ;
193191
194192 persist_cache. cfg . build_version = second_version. clone ( ) ;
@@ -210,30 +208,32 @@ async fn test_version_regression() {
210208
211209 assert_eq ! (
212210 Some ( second_version. clone( ) ) ,
213- fetch_catalog_upgrade_shard_version( & persist_client, catalog_shard_id ) . await
211+ fetch_catalog_upgrade_shard_version( & persist_client, upgrade_shard_id ) . await
214212 ) ;
215213
216- persist_cache. cfg . build_version = first_version. clone ( ) ;
217- let persist_client = persist_cache
218- . open ( PersistLocation :: new_in_mem ( ) )
219- . await
220- . expect ( "in-mem location is valid" ) ;
221- let err = TestCatalogStateBuilder :: new ( persist_client. clone ( ) )
222- . with_organization_id ( organization_id)
223- . with_deploy_generation ( deploy_generation)
224- . with_version ( first_version. clone ( ) )
225- . build ( )
226- . await
227- . expect_err ( "skipping versions should error" ) ;
228- assert ! (
229- matches!(
230- & err,
231- DurableCatalogError :: IncompatiblePersistVersion {
232- found_version,
233- catalog_version
234- }
235- if found_version == & second_version && catalog_version == & first_version
236- ) ,
237- "Unexpected error: {err:?}"
238- ) ;
214+ // NB: running the following is expected to halt the process, but we can't catch halts in tests.
215+ //
216+ // persist_cache.cfg.build_version = first_version.clone();
217+ // let persist_client = persist_cache
218+ // .open(PersistLocation::new_in_mem())
219+ // .await
220+ // .expect("in-mem location is valid");
221+ // let err = TestCatalogStateBuilder::new(persist_client.clone())
222+ // .with_organization_id(organization_id)
223+ // .with_deploy_generation(deploy_generation)
224+ // .with_version(first_version.clone())
225+ // .build()
226+ // .await
227+ // .expect_err("skipping versions should error");
228+ // assert!(
229+ // matches!(
230+ // &err,
231+ // DurableCatalogError::IncompatiblePersistVersion {
232+ // found_version,
233+ // catalog_version
234+ // }
235+ // if found_version == &second_version && catalog_version == &first_version
236+ // ),
237+ // "Unexpected error: {err:?}"
238+ // );
239239}
0 commit comments