-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: add memory catalog test to handle table removal before schema deregistration #17307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…e-removal-before-schema-deregistration-
@alamb Can you help me take a look if you have time? I just added a test. If it doesn't work, I can close it. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @caicancai 🙏
|
||
cat.register_schema("foo", schema.clone()).unwrap(); | ||
schema.deregister_table("t").unwrap(); | ||
assert!(cat.deregister_schema("foo", false).unwrap().is_some()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this just follows the pattern of the existing tests in this module, so that is good
I think a better pattern for checking errors is to verify that the error is actually the error that is expected (to make sure it isn't an error in the test setup, for example).
Something like
assert!(cat.deregister_schema("foo", false).unwrap().is_some()); | |
let err = cat.deregister_schema("foo", false).unwrap_err().to_string(); | |
assert!(err.contains("expected error message"), "Can't find expected in {err}")); |
That would be a nice follow on PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alamb Thanks for the suggestion, but the above code will report an error
called
Result::unwrap_err()on an
Okvalue: Some(MemorySchemaProvider { tables: {} })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And referring to other tests, they are all written in a similar way, assert!(cat.deregister_schema("foo", false).unwrap().is_some())
; Maybe it would be better to keep the original writing.
…e-removal-before-schema-deregistration-
Which issue does this PR close?
Contrast with the memory_catalog_dereg_nonempty_schema test
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?