update rust mysql client integration test

This commit is contained in:
Stephanie You
2023-05-12 14:07:07 -07:00
parent ff7de18057
commit ed672aa5d4
4 changed files with 30 additions and 8 deletions

View File

@@ -38,8 +38,6 @@ RUN apt update -y && \
git \
ruby \
ruby-dev \
rustc \
cargo \
gem \
libc6 \
libgcc1 \
@@ -119,6 +117,10 @@ RUN gem install bundler -v 2.1.4 && bundle install
RUN Rscript -e 'install.packages(c("DBI", "RMySQL", "RMariaDB"), \
repos = c(RSPM="https://packagemanager.rstudio.com/cran/__linux__/focal/latest"))'
# install rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# install postgres and psql
RUN service postgresql start

View File

@@ -165,6 +165,6 @@ EOF" -m "postgres"
@test "rust mysql.connector client" {
cd $BATS_TEST_DIRNAME/rust
cargo build
cargo run -- $USER $PORT $REPO_NAME
cargo run --bin mysql_connector_test $USER $PORT $REPO_NAME
}

View File

@@ -2,7 +2,7 @@
name = "mysql_connector_test"
version = "0.0.1"
edition = "2018"
# edition = "2018"
[dependencies]
mysql = "*"

View File

@@ -1,9 +1,29 @@
// any imports?
use std::collections::HashMap;
use mysql::*;
//use mysql::*;
//use mysql::prelude::*;
use std::env;
use std::process::exit;
fn main() {
let args: Vec<String> = env::args().collect();
let user = &args[1];
let port = &args[2];
let db = &args[3];
let url = format!("mysql://{}@127.0.0.1:{}/{}", user, port, db);
//let pool = Pool::new(url).unwrap();
//let mut conn = pool.get_conn().unwrap();
println!("USER: {}", user);
println!("PORT: {}", port);
println!("DB: {}", db);
println!("URL: {}", url);
exit(0)
}
/*
use std::collections::HashMap;
// queries
const QUERY_RESPONSE: HashMap<&str, i32> = HashMap::from([
("create table test (pk int, `value` int, primary key(pk))", 0),
@@ -51,4 +71,4 @@ fn main() {
}
exit(0)
}
}*/