diff --git a/Jenkinsfile.cd b/Jenkinsfile.cd index 9d5844cba1..6d29473a6f 100644 --- a/Jenkinsfile.cd +++ b/Jenkinsfile.cd @@ -230,23 +230,21 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) { } } - if (env_name == 'Ubuntu') { // TODO: Delete condition IS-702 - sh "cp libnullpay/target/release/libnullpay.so cli" - sh "cp libindy/target/release/libindy.so cli" - dir('cli') { - testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") { - echo "${env_name} Indy Cli Test: Build" - sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release" + sh "cp libnullpay/target/release/libnullpay.so cli" + sh "cp libindy/target/release/libindy.so cli" + dir('cli') { + testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") { + echo "${env_name} Indy Cli Test: Build" + sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release" - echo "${env_name} Indy Cli Test: Build Tests" - sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run' + echo "${env_name} Indy Cli Test: Build Tests" + sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run' - echo "${env_name} Indy Cli Test: Run tests" - sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"' + echo "${env_name} Indy Cli Test: Run tests" + sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"' - if (stashBuildResults) { - stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult' - } + if (stashBuildResults) { + stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult' } } } diff --git a/Jenkinsfile.ci b/Jenkinsfile.ci index 1522446276..0322ce59ef 100644 --- a/Jenkinsfile.ci +++ b/Jenkinsfile.ci @@ -362,10 +362,6 @@ def linuxNodejsTesting(env_name, network_name, testEnv) { } def linuxCLITesting(env_name, network_name, testEnv) { - if (env_name == "RedHat"){ // TODO: Delete it IS-702 - return; - } - unstash name: "LibindyCliSO${env_name}" unstash name: "LibnullpayCliSO${env_name}" @@ -457,4 +453,4 @@ def setupBrewPackages() { sh "brew switch libsodium 1.0.12" sh "brew switch openssl 1.0.2l" sh "brew switch zeromq 4.2.3" -} \ No newline at end of file +} diff --git a/cli/src/commands/common.rs b/cli/src/commands/common.rs index 2a176bf334..6fa97d1ad4 100644 --- a/cli/src/commands/common.rs +++ b/cli/src/commands/common.rs @@ -112,7 +112,7 @@ pub mod load_plugin_command { } pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Result<(), ()> { - let lib = libloading::Library::new(library) + let lib = _load_lib(library) .map_err(|_| println_err!("Plugin not found: {:?}", library))?; unsafe { @@ -131,6 +131,17 @@ pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Re Ok(()) } +#[cfg(all(unix, test))] +fn _load_lib(library: &str) -> libloading::Result { + libloading::os::unix::Library::open(Some(library), ::libc::RTLD_NOW | ::libc::RTLD_NODELETE) + .map(libloading::Library::from) +} + +#[cfg(any(not(unix), not(test)))] +fn _load_lib(library: &str) -> libloading::Result { + libloading::Library::new(library) +} + pub mod exit_command { use super::*; @@ -202,7 +213,7 @@ pub mod tests { } pub fn load_null_payment_plugin(ctx: &CommandContext) -> () { - let lib = libloading::Library::new(NULL_PAYMENT_PLUGIN).unwrap(); + let lib = _load_lib(NULL_PAYMENT_PLUGIN).unwrap(); unsafe { let init_func: libloading::Symbol ErrorCode> = lib.get(NULL_PAYMENT_PLUGIN_INIT_FUNCTION.as_bytes()).unwrap(); init_func(); diff --git a/libindy/src/commands/did.rs b/libindy/src/commands/did.rs index e8a89c4449..c99ecc2686 100644 --- a/libindy/src/commands/did.rs +++ b/libindy/src/commands/did.rs @@ -217,7 +217,7 @@ impl DidCommandExecutor { let (did, key) = self.crypto_service.create_my_did(&my_did_info)?; if self.wallet_service.record_exists::(wallet_handle, &did.did)? { - return Err(IndyError::DidError(DidError::AlreadyExistsError("Did already exists".to_string()))); + return Err(IndyError::DidError(DidError::AlreadyExistsError(did.did))); }; self.wallet_service.add_indy_object(wallet_handle, &did.did, &did, &HashMap::new())?; diff --git a/libindy/src/services/wallet/encryption.rs b/libindy/src/services/wallet/encryption.rs index 4a22a3e98f..dabfb058fb 100644 --- a/libindy/src/services/wallet/encryption.rs +++ b/libindy/src/services/wallet/encryption.rs @@ -181,4 +181,4 @@ mod tests { let u = decrypt_tags(&None, &tag_name_key, &tag_value_key).unwrap(); assert!(u.is_none()); } -} \ No newline at end of file +} diff --git a/libindy/src/services/wallet/export_import.rs b/libindy/src/services/wallet/export_import.rs index 3e2291a661..b8eafde6f1 100644 --- a/libindy/src/services/wallet/export_import.rs +++ b/libindy/src/services/wallet/export_import.rs @@ -1107,4 +1107,4 @@ mod tests { let res = wallet.get(type1, name1, _options()); assert_match!(Err(WalletError::ItemNotFound), res); } -} \ No newline at end of file +} diff --git a/libindy/src/services/wallet/mod.rs b/libindy/src/services/wallet/mod.rs index 513c91c8c5..d3eda90a52 100644 --- a/libindy/src/services/wallet/mod.rs +++ b/libindy/src/services/wallet/mod.rs @@ -583,7 +583,7 @@ impl WalletService { match self.open_wallet(name, None, credentials) { Err(err) => { // Ignores the error, since there is nothing that can be done - self.delete_wallet(name, credentials).ok(); // TODO: why do we ignore thr result here? ok is used to avoid warning + let _ = self.delete_wallet(name, credentials); // TODO: why do we ignore thr result here? ok is used to avoid warning Err(err) } Ok(wallet_handle) => { @@ -593,7 +593,7 @@ impl WalletService { match import(wallet, reader, &import_config.key) { Ok(_) => Ok(()), err @ Err(_) => { - self.delete_wallet(name, credentials).ok(); // TODO: why do we ignore thr result here? ok is used to avoid warning + let _ = self.delete_wallet(name, credentials); // TODO: why do we ignore thr result here? ok is used to avoid warning err } } @@ -1819,4 +1819,4 @@ mod tests { let res = wallet_service.open_wallet("test_wallet", None, &_credentials()); assert_match!(Err(_), res); } -} \ No newline at end of file +} diff --git a/libindy/src/services/wallet/storage/default/mod.rs b/libindy/src/services/wallet/storage/default/mod.rs index 0f37158c6d..f9e35dbd66 100644 --- a/libindy/src/services/wallet/storage/default/mod.rs +++ b/libindy/src/services/wallet/storage/default/mod.rs @@ -734,7 +734,6 @@ mod tests { use std::collections::HashMap; use std::env; - fn _create_and_open_test_storage() -> Box { _prepare_path(); let storage_type = SQLiteStorageType::new(); diff --git a/libindy/src/services/wallet/storage/plugged/mod.rs b/libindy/src/services/wallet/storage/plugged/mod.rs index c5d8758877..b1b4f3a4d7 100644 --- a/libindy/src/services/wallet/storage/plugged/mod.rs +++ b/libindy/src/services/wallet/storage/plugged/mod.rs @@ -2179,4 +2179,4 @@ mod tests { assert_eq!(&expected_free_record_call, debug.get(6).unwrap()); assert_eq!(&expected_free_search_call, debug.get(7).unwrap()); } -} \ No newline at end of file +} diff --git a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs index 76d3632a67..5fc4d6883a 100644 --- a/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs +++ b/libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs @@ -115,4 +115,4 @@ mod tests { let u = ChaCha20Poly1305IETF::decrypt(&c, &key, &nonce).unwrap(); assert_eq!(data, u) } -} \ No newline at end of file +}