Browse Source

fix running tests, process.exit instead of api.disconnect

Mokhtar Naamani 3 years ago
parent
commit
20057e6ea1
5 changed files with 20 additions and 15 deletions
  1. 4 1
      .env
  2. 8 4
      docker-compose.yml
  3. 0 6
      query-node/run-tests.sh
  4. 3 3
      tests/network-tests/src/Api.ts
  5. 5 1
      tests/network-tests/src/Scenario.ts

+ 4 - 1
.env

@@ -35,4 +35,7 @@ WARTHOG_APP_PORT=4002
 WARTHOG_APP_HOST=localhost
 
 # Default configuration is to use the docker container
-WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944/
+WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944/
+
+# If running joystream-node on host machine you can use following address to reach it instead
+# WS_PROVIDER_ENDPOINT_URI=ws://host.docker.internal:9944/

+ 8 - 4
docker-compose.yml

@@ -38,14 +38,18 @@ services:
     image: joystream/apps
     restart: on-failure
     depends_on:
-      - "joystream-node"
       - "ipfs"
     build:
       context: .
       dockerfile: apps.Dockerfile
+    env_file:
+      # relative to working directory where docker-compose was run from
+      - .env
+    environment:
+      - WS_PROVIDER_ENDPOINT_URI=${WS_PROVIDER_ENDPOINT_URI}
     ports:
       - '127.0.0.1:3001:3001'
-    command: colossus --dev --ws-provider ws://joystream-node:9944 --ipfs-host ipfs
+    command: colossus --dev --ws-provider ${WS_PROVIDER_ENDPOINT_URI} --ipfs-host ipfs
     environment:
       - DEBUG=*
 
@@ -106,7 +110,7 @@ services:
     command: ["workspace", "query-node-root", "processor:start"]
 
   indexer:
-    image: joystream/hydra-indexer:latest
+    image: joystream/hydra-indexer:2.1.0-beta.5
     restart: unless-stopped
     env_file:
       # relative to working directory where docker-compose was run from
@@ -127,7 +131,7 @@ services:
       sh -c "yarn db:bootstrap && yarn start:prod"
 
   hydra-indexer-gateway:
-    image: joystream/hydra-indexer-gateway:latest
+    image: joystream/hydra-indexer-gateway:2.1.0-beta.5
     restart: unless-stopped
     env_file:
       # relative to working directory where docker-compose was run from

+ 0 - 6
query-node/run-tests.sh

@@ -4,9 +4,6 @@ set -e
 SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
 cd $SCRIPT_PATH
 
-# Only run codegen if no generated files found
-[ ! -d "generated/" ] && yarn build
-
 set -a
 . ../.env
 set +a
@@ -35,9 +32,6 @@ yarn workspace query-node-root db:migrate
 
 docker-compose up -d graphql-server
 
-# Start the joystream-node before the indexer
-docker-compose up -d joystream-node
-
 # Starting up processor will bring up all services it depends on
 docker-compose up -d processor
 

+ 3 - 3
tests/network-tests/src/Api.ts

@@ -86,9 +86,9 @@ export class ApiFactory {
     return new Api(this.api, this.treasuryAccount, this.keyring, label)
   }
 
-  public close(): void {
-    this.api.disconnect()
-  }
+  // public close(): void {
+  //   this.api.disconnect()
+  // }
 }
 
 export class Api {

+ 5 - 1
tests/network-tests/src/Scenario.ts

@@ -58,5 +58,9 @@ export async function scenario(scene: (props: ScenarioProps) => Promise<void>):
 
   // Note: disconnecting and then reconnecting to the chain in the same process
   // doesn't seem to work!
-  apiFactory.close()
+  // Disconnecting is causing error to be thrown:
+  // RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: disconnected from ws://127.0.0.1:9944: 1000:: Normal connection closure
+  // Are there subsciptions somewhere?
+  // apiFactory.close()
+  process.exit()
 }