Skip to content

Commit

Permalink
fix(test): pass user name for regress tests (#3854)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
lmatz and mergify[bot] authored Jul 14, 2022
1 parent 9b0d3a1 commit 048587d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/tests/regress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ tests: boolean
* Run
```shell
RUST_BACKTRACE=1 target/debug/risingwave_regress_test -h 127.0.0.1 \
-p 4567 \
-p 4566 \
-u root \
--input `pwd`/src/tests/regress/data \
--output `pwd`/src/tests/regress/output \
--schedule `pwd`/src/tests/regress/data/schedule
```
Please remove the `output` directory before running the test again.

# Reference

Expand Down
4 changes: 4 additions & 0 deletions src/tests/regress/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ impl Opts {
SocketAddrV4::new(self.pg_server_host, self.pg_server_port)
}

pub(crate) fn pg_user_name(&self) -> &str {
&self.pg_user_name
}

pub(crate) fn log4rs_config_path(&self) -> &Path {
self.log4rs_config.as_path()
}
Expand Down
18 changes: 9 additions & 9 deletions src/tests/regress/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,26 @@ impl Schedule {
impl TestCase {
async fn run(self) -> anyhow::Result<TestResult> {
let mut command = Command::new("psql");
command.args([
let args = [
"-X",
"-a",
"-q",
"-h",
self.opts.host().as_str(),
&self.opts.host().to_string(),
"-p",
format!("{}", self.opts.port()).as_str(),
&self.opts.port().to_string(),
"-d",
self.opts.database_name(),
"-U",
self.opts.pg_user_name(),
"-v",
"HIDE_TABLEAM=on",
"-v",
"HIDE_TOAST_COMPRESSION=on",
]);
];
command.args(args);

println!("Ready to run command:\npsql {}", args.join(" "));

let input_path = self.file_manager.source_of(&self.test_name)?;
let input_file = File::options()
Expand Down Expand Up @@ -266,11 +271,6 @@ impl TestCase {
if expected_output == actual_output {
Ok(Same)
} else {
error!(
"Expected output of [{}] is different from actual output.\n{}",
self.test_name,
format_diff(&expected_output, &actual_output)
);
Ok(Different)
}
}
Expand Down

0 comments on commit 048587d

Please sign in to comment.