MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_debug

Function test_debug

src/catalog/tests/debug.rs:179–354  ·  view source on GitHub ↗
(state_builder: TestCatalogStateBuilder)

Source from the content-addressed store, hash-verified

177}
178
179async fn test_debug(state_builder: TestCatalogStateBuilder) {
180 let state_builder = state_builder.with_default_deploy_generation();
181 let mut openable_state1 = state_builder.clone().unwrap_build().await;
182 // Check initial empty trace.
183 let err = openable_state1.trace_unconsolidated().await.unwrap_err();
184 assert_eq!(
185 err.to_string(),
186 CatalogError::Durable(DurableCatalogError::Uninitialized).to_string()
187 );
188
189 // Check initial epoch.
190 let err = openable_state1.epoch().await.unwrap_err();
191 assert_eq!(
192 err.to_string(),
193 CatalogError::Durable(DurableCatalogError::Uninitialized).to_string()
194 );
195
196 // Use `NOW_ZERO` for consistent timestamps in the snapshots.
197 let _ = openable_state1
198 .open(NOW_ZERO().into(), &test_bootstrap_args())
199 .await
200 .unwrap()
201 .0;
202
203 // Check epoch
204 let mut openable_state2 = state_builder.clone().unwrap_build().await;
205 let epoch = openable_state2.epoch().await.unwrap();
206 assert_eq!(Epoch::new(2).unwrap(), epoch);
207
208 // Check opened trace.
209 let mut unconsolidated_trace = openable_state2.trace_unconsolidated().await.unwrap();
210 unconsolidated_trace.sort();
211 {
212 let test_trace = StableTrace(&unconsolidated_trace);
213 let expected_ts = Timestamp::new(2);
214
215 let ((user_version_key, user_version_value), user_version_ts, user_version_diff) =
216 test_trace.user_version().unwrap();
217 assert_eq!(user_version_key.key, USER_VERSION_KEY);
218 assert_eq!(user_version_value.value, CATALOG_VERSION);
219 assert_eq!(user_version_ts, &expected_ts);
220 assert_eq!(*user_version_diff, Diff::ONE);
221
222 let (
223 (builtin_migration_shard_key, builtin_migration_shard_value),
224 builtin_migration_shard_ts,
225 builtin_migration_shard_diff,
226 ) = test_trace.builtin_migration_shard().unwrap();
227 assert_eq!(
228 builtin_migration_shard_key.name,
229 BUILTIN_MIGRATION_SHARD_KEY
230 );
231 let _shard_id: ShardId = builtin_migration_shard_value.value.parse().unwrap();
232 assert_eq!(builtin_migration_shard_ts, &expected_ts);
233 assert_eq!(*builtin_migration_shard_diff, Diff::ONE);
234
235 let (
236 (expression_cache_shard_key, expression_cache_shard_value),

Callers 1

test_persist_debugFunction · 0.85

Calls 15

test_bootstrap_argsFunction · 0.85
StableTraceClass · 0.85
unwrap_buildMethod · 0.80
trace_unconsolidatedMethod · 0.80
epochMethod · 0.80
unwrapMethod · 0.80
sortMethod · 0.80
open_debugMethod · 0.80
trace_consolidatedMethod · 0.80
cloneMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected