this test was jamming up in azure CI (#3349)

* this test was jamming up in azure CI

* peer handshake test requires global chain type
This commit is contained in:
Antioch Peverell 2020-06-10 21:56:28 +01:00 committed by GitHub
parent e7f04240fb
commit 6757a3040d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View file

@ -96,7 +96,6 @@ fn tx_double_ser_deser() {
}
#[test]
#[should_panic(expected = "Keychain Error")]
fn test_zero_commit_fails() {
test_setup();
let keychain = ExtKeychain::from_random_seed(false).unwrap();
@ -104,13 +103,13 @@ fn test_zero_commit_fails() {
let key_id1 = ExtKeychain::derive_key_id(1, 1, 0, 0, 0);
// blinding should fail as signing with a zero r*G shouldn't work
build::transaction(
let res = build::transaction(
KernelFeatures::Plain { fee: 0 },
vec![input(10, key_id1.clone()), output(10, key_id1)],
&keychain,
&builder,
)
.unwrap();
);
assert!(res.is_err());
}
fn verifier_cache() -> Arc<RwLock<dyn VerifierCache>> {

View file

@ -38,7 +38,8 @@ fn open_port() -> u16 {
// Setup test with AutomatedTesting chain_type;
fn test_setup() {
global::set_local_chain_type(global::ChainTypes::AutomatedTesting);
// Set "global" chain type here as we spawn peer threads for read/write.
global::init_global_chain_type(global::ChainTypes::AutomatedTesting);
util::init_test_logger();
}
@ -69,11 +70,7 @@ fn peer_handshake() {
);
let p2p_inner = server.clone();
let _ = thread::spawn(move || {
// Test setup relies on thread local for chain_type so make sure we setup here.
test_setup();
p2p_inner.listen()
});
let _ = thread::spawn(move || p2p_inner.listen());
thread::sleep(time::Duration::from_secs(1));