Skip to content

Commit

Permalink
refactor: remove proptests (#2748)
Browse files Browse the repository at this point in the history
some more prereq work for making the tableoptions more flexible as part
of #2744.

The `Arbitrary` trait has a cascading effect, so it's kind of all or
nothing, and since we can't have `trait TableOptions: Arbitrary` in an
object-safe way, it's gotta go.
  • Loading branch information
universalmind303 authored Mar 6, 2024
1 parent 2849edc commit 04c88c8
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 213 deletions.
77 changes: 0 additions & 77 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions crates/metastore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "metastore"
version = {workspace = true}
edition = {workspace = true}
version = { workspace = true }
edition = { workspace = true }

[lints]
workspace = true

[dependencies]
ioutil = {path = "../ioutil"}
logutil = {path = "../logutil"}
protogen = {path = "../protogen"}
ioutil = { path = "../ioutil" }
logutil = { path = "../logutil" }
protogen = { path = "../protogen" }
sqlbuiltins = { path = "../sqlbuiltins" }
object_store_util = {path = "../object_store_util"}
pgrepr = {path = "../pgrepr"}
object_store_util = { path = "../object_store_util" }
pgrepr = { path = "../pgrepr" }
async-trait = { workspace = true }
datafusion = { workspace = true }
futures = { workspace = true }
Expand All @@ -26,10 +26,6 @@ tracing = { workspace = true }
uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
bytes = "1.4"
once_cell = "1.19.0"
proptest-derive = "0.4"
tower = "0.4"
dashmap = "5.5.0"
catalog = { path = "../catalog" }

[dev-dependencies]
proptest = "1.4"
2 changes: 0 additions & 2 deletions crates/protogen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ thiserror.workspace = true
tonic = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
proptest = "1.4"
proptest-derive = "0.4"
uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
tracing = { workspace = true }

Expand Down
40 changes: 10 additions & 30 deletions crates/protogen/src/metastore/types/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::str::FromStr;

use datafusion::arrow::datatypes::DataType;
use datafusion::logical_expr::{Signature, TypeSignature, Volatility};
use proptest_derive::Arbitrary;

use super::options::{
CredentialsOptions,
Expand Down Expand Up @@ -186,7 +185,7 @@ impl TryFrom<CatalogEntry> for catalog::CatalogEntry {
}
}

#[derive(Debug, Clone, Copy, Arbitrary, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum EntryType {
Database,
Schema,
Expand Down Expand Up @@ -263,7 +262,7 @@ impl fmt::Display for EntryType {
}

/// Metadata associated with every entry in the catalog.
#[derive(Debug, Clone, Arbitrary, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct EntryMeta {
pub entry_type: EntryType,
pub id: u32,
Expand Down Expand Up @@ -304,7 +303,7 @@ impl TryFrom<catalog::EntryMeta> for EntryMeta {
}
}

#[derive(Debug, Clone, Copy, Arbitrary, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SourceAccessMode {
ReadOnly,
ReadWrite,
Expand Down Expand Up @@ -382,7 +381,7 @@ impl From<SourceAccessMode> for i32 {
}
}

#[derive(Debug, Clone, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DatabaseEntry {
pub meta: EntryMeta,
pub options: DatabaseOptions,
Expand Down Expand Up @@ -414,7 +413,7 @@ impl From<DatabaseEntry> for catalog::DatabaseEntry {
}
}

#[derive(Debug, Clone, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SchemaEntry {
pub meta: EntryMeta,
}
Expand Down Expand Up @@ -484,7 +483,7 @@ impl fmt::Display for TableEntry {
}
}

#[derive(Debug, Clone, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ViewEntry {
pub meta: EntryMeta,
pub sql: String,
Expand Down Expand Up @@ -513,7 +512,7 @@ impl From<ViewEntry> for catalog::ViewEntry {
}
}

#[derive(Debug, Clone, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TunnelEntry {
pub meta: EntryMeta,
pub options: TunnelOptions,
Expand All @@ -539,7 +538,7 @@ impl From<TunnelEntry> for catalog::TunnelEntry {
}
}

#[derive(Debug, Clone, Copy, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FunctionType {
Aggregate,
Scalar,
Expand Down Expand Up @@ -590,7 +589,7 @@ impl From<FunctionType> for catalog::FunctionType {
}

/// The runtime preference for a function.
#[derive(Debug, Clone, Copy, Arbitrary, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum RuntimePreference {
Unspecified,
Local,
Expand Down Expand Up @@ -809,7 +808,7 @@ impl From<FunctionEntry> for catalog::FunctionEntry {
}
}

#[derive(Debug, Clone, Arbitrary, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CredentialsEntry {
pub meta: EntryMeta,
pub options: CredentialsOptions,
Expand Down Expand Up @@ -840,28 +839,9 @@ impl From<CredentialsEntry> for catalog::CredentialsEntry {

#[cfg(test)]
mod tests {
use proptest::arbitrary::any;
use proptest::proptest;

use super::*;

proptest! {
#[test]
fn roundtrip_entry_type(expected in any::<EntryType>()) {
let p: catalog::entry_meta::EntryType = expected.into();
let got: EntryType = p.try_into().unwrap();
assert_eq!(expected, got);
}
}

proptest! {
#[test]
fn roundtrip_entry_meta(expected in any::<EntryMeta>()) {
let p: catalog::EntryMeta = expected.clone().into();
let got: EntryMeta = p.try_into().unwrap();
assert_eq!(expected, got);
}
}

#[test]
fn convert_catalog_state_no_deployment_metadata() {
Expand Down
Loading

0 comments on commit 04c88c8

Please sign in to comment.