Skip to content

Commit

Permalink
Enable native integration tests on Linux [ECR-2789] (#697)
Browse files Browse the repository at this point in the history
Enable native integration tests on Linux & use rocksdb and snappy apt packages
on Travis CI. Rocksdb is installed from our Exonum PPA. It does not seem
to cause SIGILL on some systems unlike the Rocksdb from the default repository.

Reverts #282
  • Loading branch information
Ilya Bogdanov authored and dmitry-timofeev committed Mar 18, 2019
1 parent 4e71f6a commit 8683a73
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ addons:
sources:
- sourceline: 'ppa:chris-lea/libsodium'
- sourceline: 'ppa:maarten-fonville/protobuf'
- sourceline: 'ppa:exonum/rocksdb'
packages:
- build-essential
- libsodium-dev
- librocksdb5.17
- libsnappy-dev
- libssl-dev
- pkg-config
- protobuf-compiler
Expand All @@ -28,6 +31,8 @@ env:
global:
- RUST_COMPILER_VERSION=1.32.0
- OSX_PACKAGES="libsodium rocksdb pkg-config protobuf"
- ROCKSDB_LIB_DIR=/usr/lib
- SNAPPY_LIB_DIR=/usr/lib/x86_64-linux-gnu
# REPO_TOKEN used for integration with coveralls is encoded here
- secure: Fp22iaJpttsIArAyWmdCGNtljIALTYRVKO7O+H2hgBkwHHqrU7+15sbaq3xzhz4YNWNfuFMIkFUBgd/KYHgAuNDDrtm2agib13C0lQT1NFQO9ccmNCJNsXQrYrXGwpnNqPKp0YmfBfgNwzEpBerlbtvzV/T/RZukT/403XxwxU9y5tHfQokwVLibqP2jJsxdihTfCKIOs+o6hBfArmsn+e+panEv17ZrCjOmBIM/W70Rf2rEM26wFnYsfnAUTCkpl4Ong0SYNpZZxNMtw61W8ApDY8bpz7cKUxCv7SmD3kO7Y+TTHWfWYx6FNXtUpE1vCi6I7fZAY16rViTWOX55NCeFQz56XER7ArJQZtC/nC1lZ9tGKtcofu2Rq7WUoRuTwvLTaf6VzAP/CUj0DUxkV+8WUggl3s/Im7Y9rn8Aqvh8LReZmqzTY+dJ0hFG4DLoLtl71eTEnNoumi5UleBhJPaei3wPNPHg1WlOmhFyhRCsbIIGiyFtSj/faLmdc7tN/sBFANb0g4Exl0mRNvB0IfS1gM6XouEGUTlVree68p11PnsGJGs/QaUB9F9AAGVKTZ2kz7sqkCDdGmLxzbdidYDHZtYWfOIYSJCQsA09n2Txi0fwNByKfl/spdyMmtI1uGeT803rhN9vu0NGrQFG3mU7mqO33fUDEStIQ6/xn0A=

Expand Down Expand Up @@ -74,8 +79,6 @@ before_install:
# Install OSX requirements
# TODO: Temporary fix, the problem is described here: https://jira.bf.local/browse/ECR-2795
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install $OSX_PACKAGES || brew install $OSX_PACKAGES; fi
# force building instead of using from apt.
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export ROCKSDB_BUILD=1; export SNAPPY_BUILD=1; fi

install: true # Skip the installation step, as Maven requires
# several extra properties when run on a CI server (see below).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ lazy_static! {
}

#[test]
// TODO: reenable these tests after ECR-2789
#[cfg_attr(target_os = "linux", ignore)]
fn service_id() {
let service_id: u16 = 24;
let service = ServiceMockBuilder::new(EXECUTOR.clone())
Expand All @@ -73,7 +71,6 @@ fn service_id() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn service_id_negative() {
// Check that value is converted between rust `u16` and java `short` without loss.
let service_id: u16 = -24_i16 as u16; // 65512;
Expand All @@ -84,7 +81,6 @@ fn service_id_negative() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn service_name() {
let service_name: &str = "test_service";
let service = ServiceMockBuilder::new(EXECUTOR.clone())
Expand All @@ -94,7 +90,6 @@ fn service_name() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn state_hash() {
let db = MemoryDB::new();
let snapshot = db.snapshot();
Expand All @@ -106,7 +101,6 @@ fn state_hash() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
#[should_panic(expected = "Java exception: java.lang.OutOfMemoryError")]
fn tx_from_raw_should_panic_if_java_error_occurred() {
let raw = create_empty_raw_transaction();
Expand All @@ -117,7 +111,6 @@ fn tx_from_raw_should_panic_if_java_error_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn tx_from_raw_should_return_err_if_java_exception_occurred() {
let raw = create_empty_raw_transaction();
let service = ServiceMockBuilder::new(EXECUTOR.clone())
Expand All @@ -132,7 +125,6 @@ fn tx_from_raw_should_return_err_if_java_exception_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn initialize_config() {
let db = MemoryDB::new();
let mut fork = db.fork();
Expand All @@ -146,7 +138,6 @@ fn initialize_config() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn initialize_config_null() {
let db = MemoryDB::new();
let mut fork = db.fork();
Expand All @@ -160,7 +151,6 @@ fn initialize_config_null() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn initialize_config_parse_error() {
let db = MemoryDB::new();
let mut fork = db.fork();
Expand All @@ -180,7 +170,6 @@ fn initialize_config_parse_error() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
#[should_panic(expected = "Java exception: java.lang.RuntimeException")]
fn initialize_should_panic_if_java_exception_occurred() {
let db = MemoryDB::new();
Expand All @@ -194,7 +183,6 @@ fn initialize_should_panic_if_java_exception_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn service_can_modify_db_on_initialize() {
let db = MemoryDB::new();
let service = create_test_service(EXECUTOR.clone());
Expand All @@ -216,7 +204,6 @@ fn service_can_modify_db_on_initialize() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
#[should_panic(expected = "Java exception: com.exonum.binding.fakes.mocks.TestException")]
fn after_commit_throwing() {
let service = ServiceMockBuilder::new(EXECUTOR.clone())
Expand All @@ -233,7 +220,6 @@ fn after_commit_throwing() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn after_commit_validator() {
let (builder, interactor) =
ServiceMockBuilder::new(EXECUTOR.clone()).get_mock_interaction_after_commit();
Expand Down Expand Up @@ -263,7 +249,6 @@ fn after_commit_validator() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn after_commit_auditor() {
let (builder, interactor) =
ServiceMockBuilder::new(EXECUTOR.clone()).get_mock_interaction_after_commit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const TEST_SERVICE_MODULE_NAME: &str =
"com.exonum.binding.fakes.services.service.TestServiceModule";

#[test]
// TODO: reenable this test after ECR-2789
#[cfg_attr(target_os = "linux", ignore)]
fn bootstrap() {
let service_config = ServiceConfig {
module_name: TEST_SERVICE_MODULE_NAME.to_owned(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ lazy_static! {
}

#[test]
// TODO: reenable these tests after ECR-2789
#[cfg_attr(target_os = "linux", ignore)]
fn execute_valid_transaction() {
let db = MemoryDB::new();
let snapshot = db.snapshot();
Expand All @@ -75,7 +73,6 @@ fn execute_valid_transaction() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
#[should_panic(expected = "Java exception: java.lang.OutOfMemoryError")]
fn execute_should_panic_if_java_error_occurred() {
let (panic_tx, raw) = create_throwing_mock_transaction_proxy(EXECUTOR.clone(), OOM_ERROR_CLASS);
Expand All @@ -87,7 +84,6 @@ fn execute_should_panic_if_java_error_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
#[should_panic(expected = "Java exception: java.lang.ArithmeticException")]
fn execute_should_panic_if_java_exception_occurred() {
let (panic_tx, raw) =
Expand All @@ -100,7 +96,6 @@ fn execute_should_panic_if_java_exception_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn execute_should_return_err_if_tx_exec_exception_occurred() {
let err_code: i8 = 1;
let err_message = "Expected exception";
Expand All @@ -123,7 +118,6 @@ fn execute_should_return_err_if_tx_exec_exception_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn execute_should_return_err_if_tx_exec_exception_subclass_occurred() {
let err_code: i8 = 2;
let err_message = "Expected exception subclass";
Expand All @@ -146,7 +140,6 @@ fn execute_should_return_err_if_tx_exec_exception_subclass_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn execute_should_return_err_if_tx_exec_exception_occurred_no_message() {
let err_code: i8 = 3;
let (invalid_tx, raw) = create_throwing_exec_exception_mock_transaction_proxy(
Expand All @@ -168,7 +161,6 @@ fn execute_should_return_err_if_tx_exec_exception_occurred_no_message() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn execute_should_return_err_if_tx_exec_exception_subclass_occurred_no_message() {
let err_code: i8 = 4;
let (invalid_tx, raw) = create_throwing_exec_exception_mock_transaction_proxy(
Expand All @@ -189,22 +181,19 @@ fn execute_should_return_err_if_tx_exec_exception_subclass_occurred_no_message()
assert!(err.description().is_none());
}

#[cfg_attr(target_os = "linux", ignore)]
#[test]
fn json_serialize() {
let valid_tx = create_mock_transaction_proxy(EXECUTOR.clone());
assert_eq!(serde_json::to_value(&valid_tx.0).unwrap(), *INFO_VALUE);
}

#[cfg_attr(target_os = "linux", ignore)]
#[test]
#[should_panic(expected = "Java exception: java.lang.OutOfMemoryError")]
fn json_serialize_should_panic_if_java_error_occurred() {
let panic_tx = create_throwing_mock_transaction_proxy(EXECUTOR.clone(), OOM_ERROR_CLASS);
serde_json::to_string(&panic_tx.0).unwrap();
}

#[cfg_attr(target_os = "linux", ignore)]
#[test]
fn json_serialize_should_return_err_if_java_exception_occurred() {
let invalid_tx =
Expand All @@ -217,7 +206,6 @@ fn json_serialize_should_return_err_if_java_exception_occurred() {
}

#[test]
#[cfg_attr(target_os = "linux", ignore)]
fn passing_transaction_context() {
let db = MemoryDB::new();
let keypair = crypto::gen_keypair();
Expand Down

0 comments on commit 8683a73

Please sign in to comment.