Skip to content

Commit

Permalink
deps: update to tokio v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benesch committed Jan 5, 2021
1 parent 2fa429f commit e5a9e49
Show file tree
Hide file tree
Showing 231 changed files with 525 additions and 500 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -13,7 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Swap `pin-project` for the lighter weight `pin-project-lite`
- Update to `base64` 0.13
- Update to `hmac` 0.10
- Update to `hyper-rustls` 0.21.
- Update to `hyper-rustls` 0.22
- Update to `hyper-tls` 0.5
- Update to `tokio` 1.0
- Update to `bytes` 1.0
- Update to `hyper` 0.14
- Disable `chrono`'s `oldtime` feature
- Remove dependency on `regex`
- Update to botocore 1.19.42
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/Cargo.toml
Expand Up @@ -652,14 +652,14 @@ path = "../rusoto/services/ram"
[dev-dependencies]
async-trait = "0.1.31"
env_logger = "0.7"
bytes = "0.5"
bytes = "1.0"
futures = "0.3"
log = "0.4"
rand = "0.7"
time = "0.2"
reqwest = { version = "0.10", features = ["json"] }
reqwest = "0.11"
http = "0.2"
tokio = { version = "0.2", features = ["time", "rt-core", "fs"] }
tokio = { version = "1.0", features = ["time", "rt-multi-thread", "fs"] }
chrono = "0.4.10"

[features]
Expand Down
36 changes: 18 additions & 18 deletions integration_tests/tests/cognitoidentity.rs
Expand Up @@ -6,23 +6,23 @@ extern crate rusoto_core;
extern crate time;

use rusoto_cognito_identity::{
SetIdentityPoolRolesInput,
CognitoIdentity,
CognitoIdentityClient,
ListIdentitiesInput,
ListIdentityPoolsInput,
GetOpenIdTokenForDeveloperIdentityInput,
CreateIdentityPoolInput,
DeleteIdentityPoolInput,
SetIdentityPoolRolesInput,
CognitoIdentity,
CognitoIdentityClient,
ListIdentitiesInput,
ListIdentityPoolsInput,
GetOpenIdTokenForDeveloperIdentityInput,
CreateIdentityPoolInput,
DeleteIdentityPoolInput,
CognitoProvider
};

use rusoto_iam::{
Iam,
IamClient,
CreateRoleRequest,
PutRolePolicyRequest,
DeleteRoleRequest,
Iam,
IamClient,
CreateRoleRequest,
PutRolePolicyRequest,
DeleteRoleRequest,
DeleteRolePolicyRequest
};

Expand All @@ -32,7 +32,7 @@ use rusoto_credential::ProvideAwsCredentials;
use time::OffsetDateTime;
use std::collections::HashMap;
use std::time::Duration;
use tokio::time::delay_for;
use tokio::time::sleep;
use chrono::offset::Utc;

#[tokio::test]
Expand Down Expand Up @@ -98,7 +98,7 @@ async fn should_work_with_credential_provider() {
}}
]
}}", identity_pool.identity_pool_id).replace("'", "\"");

let input_create_role = CreateRoleRequest {
assume_role_policy_document: policy,
role_name: role_name,
Expand Down Expand Up @@ -131,7 +131,7 @@ async fn should_work_with_credential_provider() {
};

client_iam.put_role_policy(role_policy_input).await.unwrap();

// Assigning the role to the identity pool
let mut roles = HashMap::new();
roles.insert("authenticated".to_string(), role.arn.clone());
Expand All @@ -143,7 +143,7 @@ async fn should_work_with_credential_provider() {
};
client_cognito.set_identity_pool_roles(roles_input).await.unwrap();


// Registering a user whose credentials will be tested
let login = "login";
let mut logins = HashMap::new();
Expand All @@ -157,7 +157,7 @@ async fn should_work_with_credential_provider() {
let response = client_cognito.get_open_id_token_for_developer_identity(register_input).await.unwrap();

// It can take time for IAM role to be ready for use
delay_for(Duration::from_secs(10)).await;
sleep(Duration::from_secs(10)).await;

// The test itself
let provider = CognitoProvider::builder()
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/elastictranscoder.rs
Expand Up @@ -217,7 +217,7 @@ async fn delete_preset() {
let preset = response.preset.unwrap();
let id = preset.id.unwrap();

tokio::time::delay_for(std::time::Duration::from_secs(2)).await;
tokio::time::sleep(std::time::Duration::from_secs(2)).await;

let request = DeletePresetRequest { id: id.clone() };
let response = client.delete_preset(request).await;
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/tests/kinesis.rs
Expand Up @@ -13,7 +13,7 @@ use futures::FutureExt;
use futures::stream::StreamExt;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use tokio::time::{delay_for, timeout};
use tokio::time::{sleep, timeout};

use rusoto_core::Region;
use rusoto_kinesis::{Kinesis, KinesisClient, ListStreamsInput};
Expand Down Expand Up @@ -115,7 +115,7 @@ async fn should_listen_for_shard_events() {

if steam_desc_result.stream_description.stream_status == "CREATING" {
println!("Stream {} still initializing, waiting...", stream.name);
delay_for(std::time::Duration::from_secs(2)).await;
sleep(std::time::Duration::from_secs(2)).await;
continue;
} else {
break
Expand All @@ -132,7 +132,7 @@ async fn should_listen_for_shard_events() {
.unwrap();
}

tokio::time::delay_for(Duration::from_secs(10)).await;
tokio::time::sleep(Duration::from_secs(10)).await;

let consumer_result = client
.register_stream_consumer(rusoto_kinesis::RegisterStreamConsumerInput {
Expand All @@ -152,7 +152,7 @@ async fn should_listen_for_shard_events() {

if consumer_desc_result.consumer_description.consumer_status == "CREATING" {
println!("Consumer for stream {} still initializing, waiting...", stream.name);
delay_for(std::time::Duration::from_secs(2)).await;
sleep(std::time::Duration::from_secs(2)).await;
continue;
} else {
break
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/s3.rs
Expand Up @@ -95,7 +95,7 @@ impl TestS3Client {
.create_bucket(create_bucket_req)
.await
.expect("Failed to create test bucket");
tokio::time::delay_for(std::time::Duration::from_secs(5)).await;
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}

async fn create_test_bucket_with_acl(&self, name: String, acl: Option<String>) {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/xray.rs
Expand Up @@ -14,7 +14,7 @@ use time::OffsetDateTime;
async fn should_get_service_graph() {
let client = XRayClient::new(Region::UsEast1);

let time = (OffsetDateTime::now_utc().timestamp() - 30) as f64; // 30 seconds in the past
let time = (OffsetDateTime::now_utc().unix_timestamp() - 30) as f64; // 30 seconds in the past
println!("{:?}", time);

let request = GetServiceGraphRequest {
Expand Down
12 changes: 6 additions & 6 deletions rusoto/core/Cargo.toml
Expand Up @@ -23,21 +23,21 @@ rustc_version = "0.2"

[dependencies]
async-trait = "0.1"
bytes = "0.5"
bytes = "1.0"
crc32fast = "1.2"
futures = "0.3"
http = "0.2"
hyper = "0.13.1"
hyper-rustls = { version = "0.21", optional = true }
hyper-tls = { version = "0.4", optional = true }
hyper = { version = "0.14", features = ["client", "http1", "tcp"] }
hyper-rustls = { version = "0.22", optional = true }
hyper-tls = { version = "0.5.0", optional = true }
lazy_static = "1.4"
log = "0.4"
md5 = "0.7"
percent-encoding = "2.1"
base64 = "0.13"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "0.2", features = ["tcp", "time", "rt-core", "fs"] }
tokio = { version = "1.0", features = ["time", "io-util"] }
xml-rs = "0.8"
flate2 = { version = "1.0", optional = true }

Expand All @@ -50,7 +50,7 @@ path = "../signature"
version = "0.45.0"

[dev-dependencies]
tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "1.0", features = ["macros"] }
env_logger = "0.7"
rand = "0.7"
serde_json = "1.0.1"
Expand Down
4 changes: 2 additions & 2 deletions rusoto/core/src/request.rs
Expand Up @@ -224,7 +224,7 @@ impl HttpClient {
let connector = HttpsConnector::new();

#[cfg(feature = "rustls")]
let connector = HttpsConnector::new();
let connector = HttpsConnector::with_native_roots();

Ok(Self::from_connector(connector))
}
Expand All @@ -235,7 +235,7 @@ impl HttpClient {
let connector = HttpsConnector::new();

#[cfg(feature = "rustls")]
let connector = HttpsConnector::new();
let connector = HttpsConnector::with_native_roots();

Ok(Self::from_connector_with_config(connector, config))
}
Expand Down
5 changes: 3 additions & 2 deletions rusoto/credential/Cargo.toml
Expand Up @@ -20,19 +20,20 @@ async-trait = "0.1"
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
dirs-next = "2.0.0"
futures = "0.3"
hyper = "0.13.1"
hyper = { version = "0.14", features = ["client", "http1", "tcp", "stream"] }
regex = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shlex = "0.1"
tokio = { version = "0.2", features = ["macros", "process"] }
tokio = { version = "1.0", features = ["process", "sync", "time"] }
zeroize = "1"

[dev-dependencies]
lazy_static = "1.4"
quickcheck = "0.9"
quickcheck_macros = "0.9"
tempfile = "3.1.0"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }

[features]
nightly-testing = []
Expand Down
4 changes: 2 additions & 2 deletions rusoto/credential_service_mock/Cargo.toml
Expand Up @@ -5,5 +5,5 @@ authors = ["Matthew Mayer <matthewkmayer@gmail.com>"]
edition = "2018"

[dependencies]
tokio = { version = "0.2", features = ["macros"] }
warp = "0.2"
hyper = { version = "0.14", features = ["http1", "server", "tcp"] }
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
44 changes: 31 additions & 13 deletions rusoto/credential_service_mock/src/main.rs
@@ -1,25 +1,43 @@
use warp::{self, path, Filter};
use std::convert::Infallible;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};

use hyper::service;
use hyper::{Body, Method, Request, Response, Server, StatusCode};

#[tokio::main]
async fn main() {
let instance_profile_role =
path!("latest" / "meta-data" / "iam" / "security-credentials").map(|| "testrole");
let instance_profile_creds =
path!("latest" / "meta-data" / "iam" / "security-credentials" / "testrole").map(|| {
r#"{
let listen_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 8080);
Server::bind(&listen_addr)
.serve(service::make_service_fn(|_conn| async {
Ok::<_, Infallible>(service::service_fn(|req| async {
Ok::<_, Infallible>(handle(req).await)
}))
}))
.await
.unwrap();
}

const ROLE_JSON: &str = r#"{
"Code" : "Success",
"LastUpdated" : "2015-08-04T00:09:23Z",
"Type" : "AWS-HMAC",
"AccessKeyId" : "Access_key_id_value",
"SecretAccessKey" : "Secret_access_key_value",
"Token" : "AAAAA",
"Expiration" : "2015-08-04T06:32:37Z"
}"#
});

let routes = warp::get()
.and(instance_profile_creds)
.or(instance_profile_role);
}"#;

warp::serve(routes).run(([127, 0, 0, 1], 8080)).await;
async fn handle(req: Request<Body>) -> Response<Body> {
match (req.method(), req.uri().path()) {
(&Method::GET, "/latest/meta-data/iam/security-credentials/") => {
Response::new(Body::from("testrole"))
}
(&Method::GET, "/latest/meta-data/iam/security-credentials/testrole") => {
Response::new(Body::from(ROLE_JSON))
}
_ => Response::builder()
.status(StatusCode::BAD_REQUEST)
.body(Body::from("unsupported"))
.unwrap(),
}
}
4 changes: 2 additions & 2 deletions rusoto/services/accessanalyzer/Cargo.toml
Expand Up @@ -18,7 +18,7 @@ targets = []

[dependencies]
async-trait = "0.1"
bytes = "0.5"
bytes = "1.0"
serde = "1.0.2"
serde_derive = "1.0.2"
serde_json = "1.0"
Expand All @@ -32,7 +32,7 @@ path = "../../core"
default-features = false

[dev-dependencies]
tokio = "0.2"
tokio = "1.0"

[dev-dependencies.rusoto_mock]
version = "0.45.0"
Expand Down
4 changes: 2 additions & 2 deletions rusoto/services/acm-pca/Cargo.toml
Expand Up @@ -18,7 +18,7 @@ targets = []

[dependencies]
async-trait = "0.1"
bytes = "0.5"
bytes = "1.0"
serde_json = "1.0"

[dependencies.futures]
Expand All @@ -34,7 +34,7 @@ version = "1.0"
features = ["derive"]

[dev-dependencies]
tokio = "0.2"
tokio = "1.0"

[dev-dependencies.rusoto_mock]
version = "0.45.0"
Expand Down
4 changes: 2 additions & 2 deletions rusoto/services/acm/Cargo.toml
Expand Up @@ -18,7 +18,7 @@ targets = []

[dependencies]
async-trait = "0.1"
bytes = "0.5"
bytes = "1.0"
serde_json = "1.0"

[dependencies.futures]
Expand All @@ -34,7 +34,7 @@ version = "1.0"
features = ["derive"]

[dev-dependencies]
tokio = "0.2"
tokio = "1.0"

[dev-dependencies.rusoto_mock]
version = "0.45.0"
Expand Down
4 changes: 2 additions & 2 deletions rusoto/services/alexaforbusiness/Cargo.toml
Expand Up @@ -18,7 +18,7 @@ targets = []

[dependencies]
async-trait = "0.1"
bytes = "0.5"
bytes = "1.0"
serde_json = "1.0"

[dependencies.futures]
Expand All @@ -34,7 +34,7 @@ version = "1.0"
features = ["derive"]

[dev-dependencies]
tokio = "0.2"
tokio = "1.0"

[dev-dependencies.rusoto_mock]
version = "0.45.0"
Expand Down

0 comments on commit e5a9e49

Please sign in to comment.