Skip to content

Commit

Permalink
fix: fix review points
Browse files Browse the repository at this point in the history
Signed-off-by: Ryota Sakamoto <[email protected]>
  • Loading branch information
ryota-sakamoto committed May 20, 2024
1 parent 91ef6db commit 221c3f6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ impl Context {
pub async fn effective_cache_key(&self) -> String {
format!(
"{}/{}",
&self.effective_region().await.as_ref(),
&self.effective_table_name()
self.effective_region().await.as_ref(),
self.effective_table_name()
)
}

Expand Down Expand Up @@ -515,7 +515,7 @@ pub async fn use_table(
let tbl = tbl.clone();
let desc: TableDescription = control::describe_table_api(cx, tbl.clone()).await;
save_using_target(cx, desc).await?;
println!("Now you're using the table '{}' ({}).", tbl, &cx.effective_region().await.as_ref());
println!("Now you're using the table '{}' ({}).", tbl, cx.effective_region().await.as_ref());
},
None => bye(1, "You have to specify a table. How to use (1). 'dy use --table mytable', or (2) 'dy use mytable'."),
};
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,16 @@ async fn prepare_table(cx: &app::Context, table_name: &str, keys: &[&str]) {
Ok(desc) => {
println!(
"Started to create table '{}' in {} region. status: {}",
&table_name,
&cx.effective_region().await.as_ref(),
table_name,
cx.effective_region().await.as_ref(),
desc.table_status.unwrap()
);
}
Err(e) => match e.into_service_error() {
CreateTableError::ResourceInUseException(_) => println!(
"[skip] Table '{}' already exists in {} region, skipping to create new one.",
&table_name,
&cx.effective_region().await.as_ref()
table_name,
cx.effective_region().await.as_ref()
),
e => {
debug!("CreateTable API call got an error -- {:#?}", e);
Expand Down
4 changes: 2 additions & 2 deletions src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ pub async fn describe_table(cx: app::Context, target_table_to_desc: Option<Strin
describe_table_api(&new_context, new_context.effective_table_name()).await;
debug!(
"Retrieved table to describe is: '{}' table in '{}' region.",
&new_context.effective_table_name(),
&new_context.effective_region().await.as_ref()
new_context.effective_table_name(),
new_context.effective_region().await.as_ref()
);

// save described table info into cache for future use.
Expand Down
1 change: 1 addition & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ impl DyneinParser {
let result = GeneratedParser::parse(Rule::map_literal, exp);
match result {
Ok(mut pair) => {
// pair is parsed through Rule::map_literal so we expect that pair should be HashMap
let item = parse_literal(pair.next().unwrap())?
.convert_attribute_value()
.as_m()
Expand Down
7 changes: 5 additions & 2 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::env;
use std::process::Command; // Run programs
// use assert_cmd::cmd::Command; // Run programs - it seems to be equal to "use assert_cmd::prelude::* + use std::process::Command"

use aws_config::{Region, SdkConfig};
use aws_config::{BehaviorVersion, Region, SdkConfig};
use aws_sdk_dynamodb::Client as DynamoDbSdkClient;
use once_cell::sync::Lazy;
use rand::{distributions::Alphanumeric, Rng};
Expand Down Expand Up @@ -340,7 +340,10 @@ async fn setup_container(port: i32) -> Result<(), Box<dyn std::error::Error>> {
// Wait dynamodb-local
// https://docs.aws.amazon.com/sdk-for-rust/latest/dg/dynamodb-local.html
let config = aws_sdk_dynamodb::config::Builder::from(
&SdkConfig::builder().region(Region::new("local")).build(),
&SdkConfig::builder()
.region(Region::new("local"))
.behavior_version(BehaviorVersion::v2024_03_28())
.build(),
)
.endpoint_url(format!("http://localhost:{}", port))
.build();
Expand Down

0 comments on commit 221c3f6

Please sign in to comment.