Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1381 from comit-network/flaky-e-2-e-tests
Browse files Browse the repository at this point in the history
Flaky e-2-e tests
  • Loading branch information
mergify[bot] authored Sep 12, 2019
2 parents f662a7c + 4e05005 commit 24d4209
Show file tree
Hide file tree
Showing 15 changed files with 8 additions and 22 deletions.
4 changes: 0 additions & 4 deletions api_tests/btsieve/bitcoin_only/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ setTimeout(async function() {
this.slow(1000);
await tobyWallet.btc().sendToAddress(toAddress, 100000000);

await bitcoin.generate(1);

const body = await btsieve.pollUntilMatches<IdMatch>(
btsieve.absoluteLocation(location)
);
Expand All @@ -90,8 +88,6 @@ setTimeout(async function() {
});

it("btsieve should respond with full transaction details when requesting on the `toAddress` bitcoin transaction query with `return_as=transaction`", async function() {
await bitcoin.generate(1);

const res = await request(
btsieve.absoluteLocation(location)
)
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth-erc20/happy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ declare var global: HarnessGlobal;
await tobyWallet.eth().fund("10");
await bob.wallet.eth().fund("5");
await alice.wallet.btc().fund(10);
await bitcoin.generate();
await alice.wallet.eth().fund("1");

const tokenContractAddress = await tobyWallet
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth-erc20/refund_beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("5");

await alice.wallet.btc().fund(10);
await bitcoin.generate();
await alice.wallet.eth().fund("1");

const tokenContractAddress = await tobyWallet
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth/happy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("11");
await alice.wallet.eth().fund("0.1");
await alice.wallet.btc().fund(10);
await bitcoin.generate();

const aliceEthBalanceBefore = await alice.wallet.eth().ethBalance();

Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth/inverted_refund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("11");
await alice.wallet.eth().fund("0.1");
await alice.wallet.btc().fund(10);
await bitcoin.generate();

const swapRequest: SwapRequest = {
alpha_ledger: {
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth/overfunded_htlc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("11");
await alice.wallet.eth().fund("0.1");
await alice.wallet.btc().fund(20);
await bitcoin.generate();

const swapRequest: SwapRequest = {
alpha_ledger: {
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth/refund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("11");
await alice.wallet.eth().fund("0.1");
await alice.wallet.btc().fund(10);
await bitcoin.generate();

const bobInitialWei = await bob.wallet.eth().ethBalance();

Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/btc_eth/underfunded_htlc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ declare var global: HarnessGlobal;
await bob.wallet.eth().fund("11");
await alice.wallet.eth().fund("0.1");
await alice.wallet.btc().fund(20);
await bitcoin.generate();

const swapRequest: SwapRequest = {
alpha_ledger: {
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/eth-erc20_btc/happy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ declare var global: HarnessGlobal;
await tobyWallet.eth().fund("10");
await alice.wallet.eth().fund("5");
await bob.wallet.btc().fund(10);
await bitcoin.generate();
await bob.wallet.eth().fund("1");

const tokenContractAddress = await tobyWallet
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/eth-erc20_btc/refund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ declare var global: HarnessGlobal;
await tobyWallet.eth().fund("10");
await alice.wallet.eth().fund("5");
await bob.wallet.btc().fund(10);
await bitcoin.generate();
await bob.wallet.eth().fund("1");

const tokenContractAddress = await tobyWallet
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/eth_btc/bitcoin_high_fee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ declare var global: HarnessGlobal;
await alice.wallet.btc().fund(0.1);
await bob.wallet.eth().fund("0.1");
await bob.wallet.btc().fund(10);
await bitcoin.generate();

const swapRequest: SwapRequest = {
alpha_ledger: {
Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/eth_btc/happy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ declare var global: HarnessGlobal;
await alice.wallet.btc().fund(0.1);
await bob.wallet.eth().fund("0.1");
await bob.wallet.btc().fund(10);
await bitcoin.generate();

const bobEthBalanceBefore = await bob.wallet.eth().ethBalance();

Expand Down
1 change: 0 additions & 1 deletion api_tests/e2e/rfc003/eth_btc/refund_beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ declare var global: HarnessGlobal;
await alice.wallet.btc().fund(0.1);
await bob.wallet.eth().fund("0.1");
await bob.wallet.btc().fund(10);
await bitcoin.generate();

const swapRequest: SwapRequest = {
alpha_ledger: {
Expand Down
2 changes: 2 additions & 0 deletions api_tests/lib/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JsonRpcProvider, TransactionRequest } from "ethers/providers";
import { BigNumber } from "ethers/utils";
import * as fs from "fs";
import * as util from "./util";
import { sleep } from "./util";

let ethersClient: JsonRpcProvider;

Expand Down Expand Up @@ -193,6 +194,7 @@ export class EthereumWallet {
}

public async signAndSend(tx: TransactionRequest) {
await sleep(1001); // instant seal is a beautiful thing, if we fire transactions too fast, than btsieve can't see the block
const wallet = new ethers.Wallet(this.keypair.privateKey, ethersClient);
const transactionResponse = await wallet.sendTransaction(tx);
return transactionResponse.wait(1);
Expand Down
12 changes: 6 additions & 6 deletions btsieve/src/ethereum/web3_http_blocksource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl BlockSource for Web3HttpBlockSource {
let web = self.web3.clone();

let poll_interval = match self.network {
Network::Mainnet => 5,
Network::Ropsten => 5,
Network::Regtest => 1,
Network::Unknown => 1,
Network::Mainnet => 5000,
Network::Ropsten => 5000,
Network::Regtest => 500,
Network::Unknown => 1000,
};

log::info!(target: "ethereum::blocksource", "polling for new blocks on {} every {} seconds", self.network, poll_interval);
log::info!(target: "ethereum::blocksource", "polling for new blocks on {} every {} miliseconds", self.network, poll_interval);

let stream = Interval::new_interval(Duration::from_secs(poll_interval))
let stream = Interval::new_interval(Duration::from_millis(poll_interval))
.map_err(Error::Timer)
.and_then(move |_| {
web.eth()
Expand Down

0 comments on commit 24d4209

Please sign in to comment.