Skip to content

Commit

Permalink
fix: avoid unittest link oom (#2962)
Browse files Browse the repository at this point in the history
  • Loading branch information
tychoish authored May 9, 2024
1 parent 25a4d43 commit ffbadc6
Show file tree
Hide file tree
Showing 46 changed files with 275 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
path: target/debug/glaredb
key: ${{ runner.os }}-glaredb-bin-${{ github.run_id }}
fail-on-cache-miss: true
- run: just unit-tests
- run: just test

cache:
# when we change the Cargo.lock we should copy the branch cache
Expand Down
12 changes: 10 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["crates/*", "xtask", "bindings/*"]
default-members = ["crates/*", "xtask"]
members = ["crates/*", "xtask", "bindings/*", "rstests"]
default-members = ["crates/*", "xtask", "rstests"]
resolver = "2"

[workspace.package]
Expand Down
4 changes: 4 additions & 0 deletions crates/arrow_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition.workspace = true
[lints]
workspace = true

[lib]
# no doctests currently implemented in this package; skip, then
doctest = false

[dependencies]
datafusion = { workspace = true }
comfy-table = { version = "7.1.1", default-features = false }
Expand Down
4 changes: 4 additions & 0 deletions crates/bench_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition = { workspace = true }
[lints]
workspace = true

[[bin]]
name = "bench_runner"
test = false

[dependencies]
logutil = {path = "../logutil"}
cli = {path = "../cli"}
Expand Down
6 changes: 5 additions & 1 deletion crates/bytesutil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ edition = {workspace = true}
[lints]
workspace = true

[lib]
# no doctests currently implemented in this package; skip, then
doctest = false

[dependencies]
bytes = { workspace = true }
bytes = { workspace = true }
6 changes: 6 additions & 0 deletions crates/catalog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ edition.workspace = true
[lints]
workspace = true


[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
datafusion = { workspace = true }
logutil = { path = "../logutil" }
Expand Down
12 changes: 4 additions & 8 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ workspace = true
name = "glaredb"
path = "src/bin/main.rs"

[lib]
doctest = false

[dependencies]
anyhow = { workspace = true }
clap = { workspace = true }
Expand Down Expand Up @@ -50,14 +53,7 @@ tokio-postgres = "0.7.8"
uuid = { version = "1.8.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
glob = "0.3.1"

# Prevent dynamic linking of lzma, which comes from datafusion
lzma-sys = { version = "*", features = ["static"] }

[dev-dependencies]
predicates = "3.1.0"
assert_cmd = "2.0.14"
tokio-postgres = "0.7.8"
tempfile = { workspace = true }
lzma-sys = { version = "*", features = ["static"] } # Prevent dynamic linking of lzma, which comes from datafusion

[build-dependencies]
built = { version = "0.7.2", features = ["git2"] }
68 changes: 68 additions & 0 deletions crates/cli/src/drop_tables_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
mod test {
use cli::args::{LocalClientOpts, StorageConfigArgs};
use cli::local::LocalSession;
use cli::server::ComputeServer;
use tokio::net::TcpListener;

#[tokio::test]
async fn test_drop_tables_removes_files() {
let rpc_listener = TcpListener::bind("localhost:0").await.unwrap();
let rpc_addr = rpc_listener.local_addr().unwrap();
let rpc_addr = rpc_addr.to_string();
let tmp_dir = tempfile::tempdir().unwrap().into_path();
let tmp_path = tmp_dir.to_str().unwrap().to_string();

let server = ComputeServer::builder()
.with_rpc_listener(rpc_listener)
.with_location(tmp_path.clone())
.connect()
.await
.unwrap();

tokio::spawn(server.serve());

let client_opts = LocalClientOpts {
spill_path: None,
data_dir: None,
cloud_url: None,
storage_config: StorageConfigArgs {
location: Some(tmp_path),
storage_options: vec![],
},
timing: false,
ignore_rpc_auth: true,
mode: cli::args::OutputMode::Table,
max_width: None,
max_rows: None,
disable_tls: true,
cloud_addr: rpc_addr,
};

let mut session = LocalSession::connect(client_opts).await.unwrap();

// This is the path where the first table is always created.
let expected_path = "databases/00000000-0000-0000-0000-000000000000/tables/20000";

let expected_path = tmp_dir.join(expected_path);

session
.execute("CREATE TABLE foo (a int, b int)")
.await
.unwrap();

session
.execute("INSERT INTO foo VALUES (1, 2)")
.await
.unwrap();

let _ = session.execute("DROP TABLE foo").await;

let dir_entries = expected_path.as_path().read_dir().unwrap();
for entry in dir_entries {
let entry = entry.unwrap();
if entry.file_type().unwrap().is_file() {
panic!("expected directory to be empty");
}
}
}
}
37 changes: 0 additions & 37 deletions crates/cli/tests/catalog_compat.rs

This file was deleted.

66 changes: 0 additions & 66 deletions crates/cli/tests/drop_tables_test.rs

This file was deleted.

4 changes: 4 additions & 0 deletions crates/datasources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition = { workspace = true }
[lints]
workspace = true

[lib]
# no doctests currently implemented in this package; skip, then
doctest = false

[dependencies]
ioutil = { path = "../ioutil" }
logutil = { path = "../logutil" }
Expand Down
4 changes: 4 additions & 0 deletions crates/decimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition = {workspace = true}
[lints]
workspace = true

[lib]
# no doctests currently implemented in this package; skip, then
doctest = false

[dependencies]
thiserror.workspace = true
num-traits = "0.2.18"
Expand Down
5 changes: 4 additions & 1 deletion crates/distexec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name = "distexec"
version = { workspace = true }
edition = { workspace = true }

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
thiserror.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions crates/glaredb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition.workspace = true
[lints]
workspace = true

[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
sqlexec = { path = "../sqlexec" }
url = { workspace = true }
Expand Down
5 changes: 5 additions & 0 deletions crates/ioutil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition = {workspace = true}
[lints]
workspace = true

[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
bytes = { workspace = true }
home = "0.5.9"
5 changes: 5 additions & 0 deletions crates/logutil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition = {workspace = true}
[lints]
workspace = true

[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
tracing = { workspace = true }
tracing-subscriber = {version = "0.3", features = ["std", "fmt", "json", "env-filter"] }
Expand Down
5 changes: 5 additions & 0 deletions crates/metastore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition = { workspace = true }
[lints]
workspace = true

[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
ioutil = { path = "../ioutil" }
logutil = { path = "../logutil" }
Expand Down
5 changes: 5 additions & 0 deletions crates/object_store_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition = { workspace = true }
[lints]
workspace = true

[lib]
# no tests currently implemented in this package; skip, then
doctest = false
test = false

[dependencies]
logutil = { path = "../logutil" }
object_store = { workspace = true, features = ["azure"] }
Expand Down
Loading

0 comments on commit ffbadc6

Please sign in to comment.