-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid unittest link oom (#2962)
- Loading branch information
Showing
46 changed files
with
275 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.