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

Function test_plan_validity

src/adapter/src/coord/validity.rs:226–417  ·  view source on GitHub ↗

unsupported operation: returning ready events from epoll_wait is not yet implemented

()

Source from the content-addressed store, hash-verified

224 #[mz_ore::test(tokio::test)]
225 #[cfg_attr(miri, ignore)] // unsupported operation: returning ready events from epoll_wait is not yet implemented
226 async fn test_plan_validity() {
227 Catalog::with_debug(|mut catalog| async move {
228 let conn_id = ConnectionId::Static(1);
229 let user = String::from("validity_user");
230 let role = "validity_role";
231 let metrics_registry = MetricsRegistry::new();
232 let metrics = Metrics::register_into(&metrics_registry);
233
234 let commit_ts = catalog.current_upper().await;
235 catalog
236 .transact(
237 None,
238 commit_ts,
239 None,
240 vec![Op::CreateRole {
241 name: role.into(),
242 attributes: RoleAttributesRaw::new(),
243 }],
244 )
245 .await
246 .expect("is ok");
247 let role = catalog.try_get_role_by_name(role).expect("must exist");
248 // Can't use a dummy session because we need a valid role for the validity check.
249 let mut session = Session::new(
250 &mz_build_info::DUMMY_BUILD_INFO,
251 SessionConfig {
252 conn_id,
253 uuid: Uuid::new_v4(),
254 user,
255 client_ip: None,
256 external_metadata_rx: None,
257 helm_chart_version: None,
258 authenticator_kind: AuthenticatorKind::None,
259 groups: None,
260 },
261 metrics.session_metrics(),
262 );
263 session.initialize_role_metadata(role.id);
264 let mut empty = PlanValidity::new(
265 &catalog,
266 BTreeSet::new(),
267 None,
268 None,
269 session.role_metadata().clone(),
270 );
271 // Push the revision back by 1 so check() takes the slow path instead of returning
272 // early on revision equality.
273 empty.transient_revision = empty
274 .transient_revision
275 .checked_sub(1)
276 .expect("must subtract");
277 let some_system_cluster = catalog
278 .clusters()
279 .find(|c| matches!(c.id, ClusterId::System(_)))
280 .expect("must exist");
281
282 // Plan generation and result assertion closures.
283 let tests: &[(

Callers

nothing calls this directly

Calls 15

expectMethod · 0.80
session_metricsMethod · 0.80
role_metadataMethod · 0.80
extend_dependenciesMethod · 0.80
UserClass · 0.50
current_upperMethod · 0.45
transactMethod · 0.45
try_get_role_by_nameMethod · 0.45
cloneMethod · 0.45
checked_subMethod · 0.45

Tested by

no test coverage detected