Skip to content

Conversation

@blackmwk
Copy link
Contributor

Which issue does this PR close?

What changes are included in this PR?

In this pr we introduced catalog test suite in catalog-loader, which could unify the behavior of catalogs.

Are these changes tested?

Yes.

@blackmwk blackmwk requested review from CTTY, kevinjqliu and sdd and removed request for kevinjqliu February 10, 2026 03:35
@blackmwk blackmwk assigned Fokko and Xuanwo and unassigned Fokko and Xuanwo Feb 10, 2026
@blackmwk blackmwk requested review from Fokko and Xuanwo February 10, 2026 03:35
Copy link
Collaborator

@CTTY CTTY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @blackmwk for the PR! This makes the test code much easier to manage.

Just finished a round of review and left some comments

let metadata_location = root_namespace_state.remove_existing_table(table_ident)?;
self.file_io.delete(&metadata_location).await
root_namespace_state.remove_existing_table(table_ident)?;
Ok(())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized we don't have a catalog API to purge table in iceberg-rust?

Probably need to add this API to better define the expected behavior

}

#[tokio::test]
async fn test_register_table() -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this? This is already covered by table_register_suite

}

#[tokio::test]
async fn test_register_table() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this is already covered by table_register_suite

) -> Result<Namespace> {
if self.namespace_exists(namespace).await? {
return Err(Error::new(
ErrorKind::DataInvalid,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ErrorKind::NamespaceAlreadyExists

) -> Result<()> {
if !self.namespace_exists(namespace).await? {
return Err(Error::new(
ErrorKind::DataInvalid,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be NamespaceNotFound

let db_name = validate_namespace(table.namespace())?;
if !self.namespace_exists(table.namespace()).await? {
return Err(Error::new(
ErrorKind::DataInvalid,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

));
}
if !self.table_exists(table).await? {
return Err(Error::new(ErrorKind::DataInvalid, "Table does not exist"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be TableNotFound


cleanup_namespace_dyn(catalog.as_ref(), &namespace).await;

assert!(catalog.get_namespace(&namespace).await.is_err());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good opportunity for us to enforce the correct error type across catalogs. Instead of assert_err, we can do something like assert_eq!(err, ErrorKind::xxx);

catalog
.create_namespace(&namespace, HashMap::new())
.await
.is_err()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we can assert exact error type

}

#[tokio::test]
async fn test_list_namespaces_returns_only_top_level_namespaces() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we migrate these tests as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unified catalog test suite.

4 participants