rpc test working
This commit is contained in:
parent
8052824f3f
commit
78e7101f85
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -257,6 +257,7 @@ dependencies = [
|
||||
"ethcore-devtools 1.3.0",
|
||||
"ethcore-ipc 1.3.0",
|
||||
"ethcore-ipc-codegen 1.3.0",
|
||||
"ethcore-ipc-nano 1.3.0",
|
||||
"ethcore-util 1.3.0",
|
||||
"ethjson 0.1.0",
|
||||
"ethstore 0.1.0",
|
||||
|
@ -32,6 +32,7 @@ bloomchain = "0.1"
|
||||
rayon = "0.3.1"
|
||||
ethstore = { path = "../ethstore" }
|
||||
semver = "0.2"
|
||||
ethcore-ipc-nano = { path = "../ipc/nano" }
|
||||
|
||||
[dependencies.hyper]
|
||||
git = "https://github.com/ethcore/hyper"
|
||||
|
@ -73,7 +73,7 @@ use evm::Factory as EvmFactory;
|
||||
use miner::{Miner, MinerService, AccountDetails};
|
||||
use util::TrieFactory;
|
||||
use ipc::IpcConfig;
|
||||
use ipc::binary::{BinaryConvertable, BinaryConvertError};
|
||||
use ipc::binary::{BinaryConvertError};
|
||||
|
||||
// re-export
|
||||
pub use types::blockchain_info::BlockChainInfo;
|
||||
|
@ -95,6 +95,7 @@ extern crate hyper;
|
||||
extern crate ethash;
|
||||
pub extern crate ethstore;
|
||||
extern crate semver;
|
||||
extern crate ethcore_ipc_nano as nanoipc;
|
||||
|
||||
#[cfg(test)] extern crate ethcore_devtools as devtools;
|
||||
#[cfg(feature = "jit" )] extern crate evmjit;
|
||||
|
@ -86,14 +86,14 @@ mod test {
|
||||
#[test]
|
||||
fn create_delete() {
|
||||
let a = PodState::from(map![ 1.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]);
|
||||
assert_eq!(super::diff_pod(&a, &PodState::new()), StateDiff(map![
|
||||
assert_eq!(super::diff_pod(&a, &PodState::new()), StateDiff { raw: map![
|
||||
1.into() => AccountDiff{
|
||||
balance: Diff::Died(69.into()),
|
||||
nonce: Diff::Died(0.into()),
|
||||
code: Diff::Died(vec![]),
|
||||
storage: map![],
|
||||
}
|
||||
]));
|
||||
]});
|
||||
assert_eq!(super::diff_pod(&PodState::new(), &a), StateDiff{ raw: map![
|
||||
1.into() => AccountDiff{
|
||||
balance: Diff::Born(69.into()),
|
||||
|
@ -18,26 +18,25 @@
|
||||
|
||||
use nanoipc;
|
||||
use std::sync::Arc;
|
||||
use std::io::Write;
|
||||
use std::sync::atomic::{Ordering, AtomicBool};
|
||||
use client::{BlockChainClient, MiningBlockChainClient, Client, ClientConfig, BlockID, RemoteClient};
|
||||
use block::IsBlock;
|
||||
use client::{Client, ClientConfig, RemoteClient};
|
||||
use tests::helpers::*;
|
||||
use common::*;
|
||||
use devtools::*;
|
||||
use miner::Miner;
|
||||
use crossbeam;
|
||||
use common::IoChannel;
|
||||
|
||||
pub fn run_test_worker(scope: &crossbeam::Scope, stop: Arc<AtomicBool>, socket_path: &str) {
|
||||
let socket_path = socket_path.to_owned();
|
||||
scope.spawn(move || {
|
||||
let temp = RandomTempPath::create_dir();
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
get_test_spec(),
|
||||
dir.as_path(),
|
||||
temp.as_path(),
|
||||
Arc::new(Miner::with_spec(get_test_spec())),
|
||||
IoChannel::disconnected()).unwrap();
|
||||
let mut worker = nanoipc::Worker::new(&Arc::new(client));
|
||||
let mut worker = nanoipc::Worker::new(&client);
|
||||
worker.add_reqrep(&socket_path).unwrap();
|
||||
while !stop.load(Ordering::Relaxed) {
|
||||
worker.poll();
|
||||
@ -46,15 +45,13 @@ pub fn run_test_worker(scope: &crossbeam::Scope, stop: Arc<AtomicBool>, socket_p
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_be_created() {
|
||||
fn can_handshake() {
|
||||
crossbeam::scope(|scope| {
|
||||
let stop_guard = StopGuard::new();
|
||||
let socket_path = "ipc:///tmp/parity-client-rpc-10.ipc";
|
||||
run_test_worker(scope, stop_guard.share(), socket_path);
|
||||
let remote_client = nanoipc::init_client::<RemoteClient<_>>(socket_path).unwrap();
|
||||
|
||||
let non_existant = remote_client.block_header(BlockID::Number(188));
|
||||
|
||||
assert!(non_existant.is_none());
|
||||
assert!(remote_client.handshake().is_ok());
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user