Skip to content

Commit

Permalink
Merge branch 'main' into kafka_sink_single_remove_host_config
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Nov 27, 2023
2 parents d3dd1b6 + 977c6f6 commit 5b49b89
Show file tree
Hide file tree
Showing 11 changed files with 814 additions and 446 deletions.
1,197 changes: 781 additions & 416 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ bytes = "1.0.0"
tokio = { version = "1.25.0", features = ["full", "macros"] }
tokio-util = { version = "0.7.7" }
tokio-openssl = "0.6.2"
itertools = "0.11.0"
itertools = "0.12.0"
openssl = { version = "0.10.36", features = ["vendored"] }
anyhow = "1.0.42"
serde = { version = "1.0.111", features = ["derive"] }
serde_yaml = "0.9.17"
uuid = { version = "1.0.0", features = ["serde", "v4"] }
reqwest = "0.11.6"
redis = { version = "0.23.0", features = ["tokio-comp", "cluster"] }
redis = { version = "0.23.3", features = ["tokio-comp", "cluster"] }
cdrs-tokio = "8.0"
cassandra-protocol = "3.0"
tracing = "0.1.15"
Expand All @@ -61,7 +61,8 @@ rand_distr = "0.4.1"
clap = { version = "4.0.4", features = ["cargo", "derive"] }
async-trait = "0.1.30"
typetag = "0.2.5"
aws-throwaway = "0.3.0"
aws-throwaway = "0.4.0"
tokio-bin-process = "0.4.0"
ordered-float = { version = "4.0.0", features = ["serde"] }
hyper = { version = "0.14.14", features = ["server"] }
shell-quote = "0.4.0"
6 changes: 3 additions & 3 deletions ec2-cargo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() {
return;
}

let aws = Aws::new(CleanupResources::AllResources).await;
let aws = Aws::builder(CleanupResources::AllResources).build().await;
let instance_type = InstanceType::from(args.instance_type.as_str());
let instance = aws
.create_ec2_instance(Ec2InstanceDefinition::new(instance_type).volume_size_gigabytes(40))
Expand Down Expand Up @@ -196,7 +196,7 @@ cargo windsock {} 2>&1
async fn rsync_push_shotover(state: &State) {
let instance = &state.instance;
let project_root_dir = &state.cargo_meta.workspace_root;
let address = instance.public_ip();
let address = instance.public_ip().unwrap().to_string();

rsync(
state,
Expand All @@ -213,7 +213,7 @@ async fn rsync_push_shotover(state: &State) {
async fn rsync_fetch_windsock_results(state: &State) {
let instance = &state.instance;
let windsock_dir = &state.cargo_meta.target_directory.join("windsock_data");
let address = instance.public_ip();
let address = instance.public_ip().unwrap().to_string();

rsync(
state,
Expand Down
2 changes: 1 addition & 1 deletion shotover-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ opensearch = "2.1.0"
serde_json = "1.0.103"
time = { version = "0.3.25" }
inferno = { version = "0.11.15", default-features = false, features = ["multithreaded", "nameattr"] }
shell-quote = "0.3.0"
hyper.workspace = true
shell-quote.workspace = true

[features]
# Include WIP alpha transforms in the public API
Expand Down
6 changes: 4 additions & 2 deletions shotover-proxy/benches/windsock/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ impl WindsockAws {
shotover_instance: RwLock::new(None),
bencher_instance: RwLock::new(None),
docker_instances: RwLock::new(vec![]),
aws: Aws::new(CleanupResources::WithAppTag(AWS_THROWAWAY_TAG.to_owned())).await,
aws: Aws::builder(CleanupResources::WithAppTag(AWS_THROWAWAY_TAG.to_owned()))
.build()
.await,
}
})
.await
Expand Down Expand Up @@ -198,7 +200,7 @@ sudo docker system prune -af"#,
let mut env_args = String::new();
for (key, value) in envs {
let key_value =
String::from_utf8(shell_quote::bash::escape(format!("{key}={value}"))).unwrap();
String::from_utf8(shell_quote::Bash::quote(&format!("{key}={value}"))).unwrap();
env_args.push_str(&format!(" -e {key_value}"))
}
let output = self
Expand Down
15 changes: 10 additions & 5 deletions shotover-proxy/tests/transforms/log_to_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ async fn log_to_file() {

assert_ok(redis::cmd("SET").arg("foo").arg(42), &mut connection).await;
let request = std::fs::read("message-log/1/requests/message1.bin").unwrap();
assert_eq!(
request,
"*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$2\r\n42\r\n".as_bytes()
);
assert_eq_string(&request, "*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$2\r\n42\r\n");

let response = std::fs::read("message-log/1/responses/message1.bin").unwrap();
assert_eq!(response, "+OK\r\n".as_bytes());
assert_eq_string(&response, "+OK\r\n");

shotover.shutdown_and_then_consume_events(&[]).await;

std::fs::remove_dir_all("message-log").unwrap();
}

/// Gives useful error message when both expected and actual data are valid utf8 strings
fn assert_eq_string(actual_bytes: &[u8], expected_str: &str) {
match std::str::from_utf8(actual_bytes) {
Ok(actual) => assert_eq!(actual, expected_str),
Err(_) => assert_eq!(actual_bytes, expected_str.as_bytes()),
}
}
6 changes: 3 additions & 3 deletions shotover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ alpha-transforms = []

[dependencies]
atomic_enum = "0.2.0"
pretty-hex = "0.3.0"
pretty-hex = "0.4.0"
tokio-stream = "0.1.2"
bytes-utils = "0.1.1"
derivative = "2.1.1"
Expand Down Expand Up @@ -75,8 +75,8 @@ crc16 = "0.4.0"
ordered-float.workspace = true

#Crypto
aws-config = "0.56.0"
aws-sdk-kms = "0.33"
aws-config = "1.0.0"
aws-sdk-kms = "1.1.0"
strum_macros = "0.25"
chacha20poly1305 = { version = "0.10.0", features = ["std"] }
generic-array = { version = "0.14", features = ["serde"] }
Expand Down
15 changes: 5 additions & 10 deletions shotover/src/transforms/protect/key_management.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::transforms::protect::aws_kms::AWSKeyManagement;
use crate::transforms::protect::local_kek::LocalKeyManagement;
use anyhow::{anyhow, Result};
use aws_config::meta::region::RegionProviderChain;
use aws_config::SdkConfig;
use aws_config::{meta::region::RegionProviderChain, BehaviorVersion};
use aws_sdk_kms::config::Region;
use aws_sdk_kms::Client as KmsClient;
use base64::{engine::general_purpose, Engine as _};
Expand Down Expand Up @@ -37,16 +37,11 @@ pub enum KeyManagerConfig {
}

async fn config(region: String, endpoint: Option<String>) -> SdkConfig {
let region_provider = RegionProviderChain::first_try(Region::new(region));
let builder = aws_config::defaults(BehaviorVersion::v2023_11_09())
.region(RegionProviderChain::first_try(Region::new(region)));
match endpoint {
Some(endpoint) => {
aws_config::from_env()
.region(region_provider)
.endpoint_url(endpoint)
.load()
.await
}
None => aws_config::from_env().region(region_provider).load().await,
Some(endpoint) => builder.endpoint_url(endpoint).load().await,
None => builder.load().await,
}
}

Expand Down
2 changes: 1 addition & 1 deletion test-helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ serde_yaml.workspace = true
anyhow.workspace = true
rcgen.workspace = true
docker-compose-runner = "0.2.0"
rdkafka = { version = "0.34", features = ["cmake-build"], optional = true }
rdkafka = { version = "0.36", features = ["cmake-build"], optional = true }
2 changes: 1 addition & 1 deletion windsock-cloud-docker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ license = "Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
shell-quote = "0.3.0"
shell-quote.workspace = true
tokio.workspace = true
subprocess.workspace = true
2 changes: 1 addition & 1 deletion windsock-cloud-docker/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Container {
if x.is_empty() {
String::from("''")
} else {
String::from_utf8(shell_quote::bash::escape(x)).unwrap()
String::from_utf8(shell_quote::Bash::quote(&x)).unwrap()
}
})
.collect();
Expand Down

0 comments on commit 5b49b89

Please sign in to comment.