Skip to content

Commit

Permalink
fix: blockchain and p2p fixes to be able to launch a network (#3619)
Browse files Browse the repository at this point in the history
  • Loading branch information
air1one authored Mar 27, 2020
1 parent a0d90d0 commit e97a18a
Show file tree
Hide file tree
Showing 39 changed files with 906 additions and 92 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/lint-test-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-bridgechain-resignation:
needs: lint

Expand Down Expand Up @@ -228,9 +225,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-bridgechain-update:
needs: lint

Expand Down Expand Up @@ -282,9 +276,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-business-registration:
needs: lint

Expand Down Expand Up @@ -336,9 +327,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-business-resignation:
needs: lint

Expand Down Expand Up @@ -390,9 +378,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-business-update:
needs: lint

Expand Down Expand Up @@ -444,9 +429,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-delegate-registration:
needs: lint

Expand Down Expand Up @@ -498,9 +480,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-delegate-resignation:
needs: lint

Expand Down Expand Up @@ -552,9 +531,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-htlc-claim:
needs: lint

Expand Down Expand Up @@ -606,9 +582,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-htlc-lock:
needs: lint

Expand Down Expand Up @@ -660,9 +633,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-htlc-refund:
needs: lint

Expand Down Expand Up @@ -714,9 +684,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-ipfs:
needs: lint

Expand Down Expand Up @@ -768,9 +735,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-multi-payment:
needs: lint

Expand Down Expand Up @@ -822,9 +786,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet

test-functional-multi-signature-registration:
needs: lint
Expand Down Expand Up @@ -877,9 +838,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-second-signature-registration:
needs: lint

Expand Down Expand Up @@ -931,9 +889,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-transfer:
needs: lint

Expand Down Expand Up @@ -985,9 +940,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
test-functional-vote:
needs: lint

Expand Down Expand Up @@ -1039,9 +991,6 @@ jobs:
env:
CORE_DB_DATABASE: ark_unitnet
CORE_DB_USERNAME: ark
POSTGRES_USER: ark
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_unitnet
# test-e2e:
# runs-on: ubuntu-latest
# strategy:
Expand Down
29 changes: 29 additions & 0 deletions __tests__/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Ark Core End-to-end Testing

<p align="center">
<img src="./img/core-e2e-banner.png" />
</p>

[![License: MIT](https://badgen.now.sh/badge/license/MIT/green)](./LICENSE)

## Introduction

E2E tests have not been enabled yet for v3, but you can still launch a network (see below).

## Install and run

You can launch and stop a network like this :

```bash
cd lib/config
docker-compose up -d # launches the network
docker-compose down -v # shuts down the network
```

This will launch a network of 5 nodes on testnet.

You can see the live output of the nodes by using the docker logs command :

```bash
docker logs config_core0_1 -f # for the first node (core0)
```
Binary file added __tests__/e2e/img/core-e2e-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions __tests__/e2e/lib/config/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
version: '2.2'
services:
peerdiscovery:
build: ./peer-discovery
image: peerdiscovery
nginx:
image: nginx:latest
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
ports:
- 4900:4900

postgres0: &postgresServiceDefinition
image: "postgres:alpine"
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: ark_testnet
POSTGRES_USER: ark
postgres1: *postgresServiceDefinition
postgres2: *postgresServiceDefinition
postgres3: *postgresServiceDefinition
postgres4: *postgresServiceDefinition

core0: &coreServiceDefinition
build: ./nodes
image: core
volumes:
- ./../../../../:/core
depends_on:
- postgres1
- peerdiscovery
command:
- /bin/sh
- -c
- /core/packages/core/bin/run core:run --network=testnet --version=3.0.0
environment: &coreEnvironment
CORE_DB_HOST: postgres0
CORE_DB_DATABASE: ark_testnet
CORE_DB_USERNAME: ark
CORE_PATH_CONFIG: /core/__tests__/e2e/lib/config/nodes/core0
CORE_PATH_DATA: /core/__tests__/e2e/lib/config/nodes/core0

core1:
<<: *coreServiceDefinition
depends_on:
- postgres1
- peerdiscovery
environment:
<<: *coreEnvironment
CORE_DB_HOST: postgres1
CORE_PATH_CONFIG: /core/__tests__/e2e/lib/config/nodes/core1
CORE_PATH_DATA: /core/__tests__/e2e/lib/config/nodes/core1

core2:
<<: *coreServiceDefinition
depends_on:
- postgres2
- peerdiscovery
environment:
<<: *coreEnvironment
CORE_DB_HOST: postgres2
CORE_PATH_CONFIG: /core/__tests__/e2e/lib/config/nodes/core2
CORE_PATH_DATA: /core/__tests__/e2e/lib/config/nodes/core2

core3:
<<: *coreServiceDefinition
depends_on:
- postgres3
- peerdiscovery
environment:
<<: *coreEnvironment
CORE_DB_HOST: postgres3
CORE_PATH_CONFIG: /core/__tests__/e2e/lib/config/nodes/core3
CORE_PATH_DATA: /core/__tests__/e2e/lib/config/nodes/core3

core4:
<<: *coreServiceDefinition
depends_on:
- postgres4
- peerdiscovery
environment:
<<: *coreEnvironment
CORE_DB_HOST: postgres4
CORE_PATH_CONFIG: /core/__tests__/e2e/lib/config/nodes/core4
CORE_PATH_DATA: /core/__tests__/e2e/lib/config/nodes/core4
13 changes: 13 additions & 0 deletions __tests__/e2e/lib/config/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 4900;

location ~ /core(\d+)(.*)$ {
resolver 127.0.0.11;
proxy_pass http://core$1:4003$2;
}
}
}
6 changes: 6 additions & 0 deletions __tests__/e2e/lib/config/nodes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM telus/build-essential
FROM python
FROM node:12.13

WORKDIR /ark-core

20 changes: 20 additions & 0 deletions __tests__/e2e/lib/config/nodes/core0/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432

CORE_P2P_HOST=0.0.0.0
CORE_P2P_PORT=4000

CORE_WEBHOOKS_HOST=0.0.0.0
CORE_WEBHOOKS_PORT=4004

CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0
CORE_EXCHANGE_JSON_RPC_PORT=8080

CORE_API_HOST=0.0.0.0
CORE_API_PORT=4003

CORE_WALLET_API_HOST=0.0.0.0
CORE_WALLET_API_PORT=4040
Loading

0 comments on commit e97a18a

Please sign in to comment.