Skip to content
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

Add random string in path generation #249

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions sqllogictest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ subst = "0.3"
tempfile = "3"
thiserror = "2"
tracing = "0.1"
rand = "0.8.5"

[dev-dependencies]
pretty_assertions = "1"
8 changes: 7 additions & 1 deletion sqllogictest/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use futures::{stream, Future, FutureExt, StreamExt};
use itertools::Itertools;
use md5::Digest;
use owo_colors::OwoColorize;
use rand::Rng;
use similar::{Change, ChangeTag, TextDiff};

use crate::parser::*;
Expand Down Expand Up @@ -1339,7 +1340,12 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {

fn create_outfile(filename: impl AsRef<Path>) -> std::io::Result<(PathBuf, File)> {
let filename = filename.as_ref();
let outfilename = filename.file_name().unwrap().to_str().unwrap().to_owned() + ".temp";
let outfilename = format!(
"{}{:010}{}",
filename.file_name().unwrap().to_str().unwrap().to_owned(),
rand::thread_rng().gen_range(0..10_000_000),
".temp"
);
let outfilename = filename.parent().unwrap().join(outfilename);
// create a temp file in read-write mode
let outfile = OpenOptions::new()
Expand Down
Loading