Skip to content

Commit

Permalink
ci/cd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Mar 8, 2024
1 parent 88c2599 commit 601aba9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci-rust-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ jobs:

- name: Casper node launcher js
run: npx casper-node-launcher-js node --daemon
env:
NODE_ADDRESS: http://127.0.0.1:7777/rpc
EVENT_ADDRESS: http://127.0.0.1:9999/events/main
PRIVATE_KEY_USER_1: MC4CAQAwBQYDK2VwBCIEII8ULlk1CJ12ZQ+bScjBt/IxMAZNggClWqK56D1/7CbI
PRIVATE_KEY_USER_2: MC4CAQAwBQYDK2VwBCIEIJTD9IlUYzuMHbvAiFel/uqd6V7vUtUD19IEQlo6SAFC

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
env:
NODE_ADDRESS: http://127.0.0.1:7777/rpc
EVENT_ADDRESS: http://127.0.0.1:9999/events/main
PRIVATE_KEY_USER_1: MC4CAQAwBQYDK2VwBCIEII8ULlk1CJ12ZQ+bScjBt/IxMAZNggClWqK56D1/7CbI
PRIVATE_KEY_USER_2: MC4CAQAwBQYDK2VwBCIEIJTD9IlUYzuMHbvAiFel/uqd6V7vUtUD19IEQlo6SAFC

- name: Test with no features
uses: actions-rs/cargo@v1
Expand Down
8 changes: 2 additions & 6 deletions src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use casper_types::{
cl_value_to_json as cl_value_to_json_from_casper_types, CLValue, ErrorExt, Key as _Key,
NamedArg, PublicKey as CasperTypesPublicKey, RuntimeArgs, SecretKey,
};
use chrono::{DateTime, NaiveDateTime, SecondsFormat, Utc};
use chrono::{DateTime, SecondsFormat, Utc};
#[cfg(target_arch = "wasm32")]
use gloo_utils::format::JsValueSerdeExt;
use rust_decimal::prelude::*;
Expand Down Expand Up @@ -52,11 +52,7 @@ pub fn cl_value_to_json(cl_value: &CLValue) -> Option<Value> {
pub fn get_current_timestamp(timestamp: Option<String>) -> String {
let parsed_timestamp = timestamp.as_ref().and_then(|ts| ts.parse::<i64>().ok());
let current_timestamp = parsed_timestamp
.map(|parsed_time| {
NaiveDateTime::from_timestamp_opt(parsed_time / 1000, 0)
.map(|naive_time| DateTime::<Utc>::from_naive_utc_and_offset(naive_time, Utc))
.unwrap_or_else(Utc::now)
})
.map(|parsed_time| DateTime::from_timestamp(parsed_time / 1000, 0).unwrap_or_else(Utc::now))
.unwrap_or_else(Utc::now);
current_timestamp.to_rfc3339_opts(SecondsFormat::Secs, true)
}
Expand Down
11 changes: 6 additions & 5 deletions src/sdk/deploy_watcher/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,13 @@ impl DeployWatcher {
/// A new `DeployWatcher` instance.
#[wasm_bindgen(constructor)]
pub fn new(events_url: String, timeout_duration: Option<u64>) -> Self {
let timeout_duration = Duration::milliseconds(
let timeout_duration = Duration::try_milliseconds(
timeout_duration
.unwrap_or(DEFAULT_TIMEOUT_MS)
.try_into()
.unwrap(),
);
)
.unwrap_or_default();

DeployWatcher {
events_url,
Expand Down Expand Up @@ -714,7 +715,7 @@ mod tests {
assert!(*deploy_watcher.active.borrow());
assert_eq!(
deploy_watcher.timeout_duration,
Duration::milliseconds(timeout_duration.try_into().unwrap())
Duration::try_milliseconds(timeout_duration.try_into().unwrap()).unwrap()
);
}

Expand All @@ -732,7 +733,7 @@ mod tests {
assert!(*deploy_watcher.active.borrow());
assert_eq!(
deploy_watcher.timeout_duration,
Duration::milliseconds(DEFAULT_TIMEOUT_MS.try_into().unwrap())
Duration::try_milliseconds(DEFAULT_TIMEOUT_MS.try_into().unwrap()).unwrap()
);
}

Expand Down Expand Up @@ -879,7 +880,7 @@ mod tests {
assert!(*deploy_watcher.active.borrow());
assert_eq!(
deploy_watcher.timeout_duration,
Duration::milliseconds(timeout_duration.try_into().unwrap())
Duration::try_milliseconds(timeout_duration.try_into().unwrap()).unwrap()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/cl/cl_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub enum CLTypeEnum {
pub struct CLType(CLTypeEnum);

#[wasm_bindgen]
#[allow(non_snake_case)]
impl CLType {
#![allow(non_snake_case)]
#[wasm_bindgen(js_name = "Bool")]
pub fn Bool() -> Self {
CLType(CLTypeEnum::Bool)
Expand Down

0 comments on commit 601aba9

Please sign in to comment.