diff options
author | Jill <kokakiwi@deuxfleurs.fr> | 2022-02-02 15:35:52 +0100 |
---|---|---|
committer | Jill <kokakiwi@deuxfleurs.fr> | 2022-02-10 17:55:49 +0100 |
commit | dd407e7041102f52611336bef304c3266a4d6fbe (patch) | |
tree | 01582c8158cdfc19a46288e04ea53da95da5a64a /src/garage/tests/common/mod.rs | |
parent | af261e17895d5d3b3bd0bdfd52b3d0db6a984a20 (diff) | |
download | garage-dd407e7041102f52611336bef304c3266a4d6fbe.tar.gz garage-dd407e7041102f52611336bef304c3266a4d6fbe.zip |
tests: Add garage integration tests (base)
Diffstat (limited to 'src/garage/tests/common/mod.rs')
-rw-r--r-- | src/garage/tests/common/mod.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/garage/tests/common/mod.rs b/src/garage/tests/common/mod.rs new file mode 100644 index 00000000..b5f7f0b2 --- /dev/null +++ b/src/garage/tests/common/mod.rs @@ -0,0 +1,45 @@ +use aws_sdk_s3::{Client, Region}; +use ext::*; + +#[macro_use] +pub mod macros; + +pub mod client; +pub mod ext; +pub mod garage; + +const REGION: Region = Region::from_static("garage-integ-test"); + +pub struct Context { + pub garage: &'static garage::Instance, + pub client: Client, +} + +impl Context { + fn new() -> Self { + let garage = garage::instance(); + let client = client::build_client(garage); + + Context { garage, client } + } + + pub fn create_bucket(&self, name: &str) { + self.garage + .command() + .args(["bucket", "create", name]) + .quiet() + .expect_success_status("Could not create bucket"); + self.garage + .command() + .args(["bucket", "allow"]) + .args(["--owner", "--read", "--write"]) + .arg(name) + .args(["--key", &self.garage.key.name]) + .quiet() + .expect_success_status("Could not allow key for bucket"); + } +} + +pub fn context() -> Context { + Context::new() +} |