mkroll-db commented on code in PR #3309:
URL: https://github.com/apache/iceberg-rust/pull/3309#discussion_r4530822668


##########
crates/iceberg/src/catalog/memory/catalog.rs:
##########
@@ -1944,6 +1964,35 @@ pub(crate) mod tests {
         );
     }
 
+    #[tokio::test]
+    async fn test_unregister_table() {
+        let catalog = new_memory_catalog().await;
+        let namespace = NamespaceIdent::new("unregister_namespace".into());
+        create_namespace(&catalog, &namespace).await;
+        let table_ident = TableIdent::new(namespace, 
"unregister_table".into());
+        create_table(&catalog, &table_ident).await;
+
+        let before = catalog.load_table(&table_ident).await.unwrap();
+        let unregistered = 
catalog.unregister_table(&table_ident).await.unwrap();
+        assert_eq!(unregistered.identifier(), &table_ident);
+        assert_eq!(unregistered.metadata_location(), 
before.metadata_location());
+        assert_eq!(unregistered.metadata(), before.metadata());
+        assert!(unregistered.readonly());
+        assert!(!catalog.table_exists(&table_ident).await.unwrap());
+
+        let err = catalog.unregister_table(&table_ident).await.unwrap_err();
+        assert_eq!(err.kind(), ErrorKind::TableNotFound);
+
+        catalog
+            .register_table(
+                &table_ident,
+                unregistered.metadata_location().unwrap().to_string(),
+            )
+            .await
+            .unwrap();
+        assert!(catalog.table_exists(&table_ident).await.unwrap());

Review Comment:
   Thank you. Good sport. I added it to the test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to