From 9851e7d5394332026845b6f56b1a3bf562b21bd4 Mon Sep 17 00:00:00 2001
From: rafaelatc3sl <rpd17@c3sl>
Date: Fri, 8 Feb 2019 09:43:43 -0200
Subject: [PATCH] Issue #102: Fix files witch ci doesn't cover

Signed-off-by: rafaelatc3sl <rpd17@c3sl>
---
 .gitlab-ci.yml                                   |  3 +--
 config/config.env.example                        | 13 +++++++------
 ...atabase_test.env.example => test.env.example} |  0
 config/test/postgres/fixtures/sellerstatus.json  |  4 ----
 docker-compose.yml                               | 16 +++++++++-------
 scripts/loadTest.ts                              |  2 +-
 scripts/schema.ts                                |  2 +-
 7 files changed, 19 insertions(+), 21 deletions(-)
 rename config/{ci_database_test.env.example => test.env.example} (100%)
 delete mode 100644 config/test/postgres/fixtures/sellerstatus.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 557eb808..b103c835 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,7 +28,7 @@ run_test:
     stage: test
     script:                
         - yarn install --frozen-lockfile --silent --non-interactive
-        - mv config/ci_database_test.env.example config/test.env
+        - mv config/test.env.example config/test.env
         - yarn test
         - yarn run lint
     tags:
@@ -59,4 +59,3 @@ deploy:
         - build
     only:
         - develop
-
diff --git a/config/config.env.example b/config/config.env.example
index 5d330011..415c3b6d 100644
--- a/config/config.env.example
+++ b/config/config.env.example
@@ -1,8 +1,9 @@
-BLENDB_DB_NAME=blendb-test
-BLENDB_DB_USER=blendb
-BLENDB_DB_PASSWORD=secret
-BLENDB_DB_HOST=localhost
-BLENDB_DB_PORT=5432
-BLENDB_ADAPTER=postgres
 BLENDB_SCHEMA_FILE=config/config.yaml.example
 PORT=3000
+BLENDB_N_DB=1
+BLENDB_DB0_USER=blendb
+BLENDB_DB0_NAME=blendb-test
+BLENDB_DB0_PASSWORD=secret
+BLENDB_DB0_HOST=localhost
+BLENDB_DB0_PORT=5432
+BLENDB_DB0_ADAPTER=postgres
diff --git a/config/ci_database_test.env.example b/config/test.env.example
similarity index 100%
rename from config/ci_database_test.env.example
rename to config/test.env.example
diff --git a/config/test/postgres/fixtures/sellerstatus.json b/config/test/postgres/fixtures/sellerstatus.json
deleted file mode 100644
index c9d05e0a..00000000
--- a/config/test/postgres/fixtures/sellerstatus.json
+++ /dev/null
@@ -1,4 +0,0 @@
-[
-    {"met:seller:count:age" : 4, "dim:seller:status" : "active"},
-    {"met:seller:count:age" : 1, "dim:seller:status" : "sick leave"}
-]
diff --git a/docker-compose.yml b/docker-compose.yml
index 2bc93dd4..cee9167e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,18 +12,20 @@ services:
         security_opt:
            - no-new-privileges
     blendb:
-        image: marula.c3sl.ufpr.br:5000/c3sl/blendb:latest
+        # image: marula.c3sl.ufpr.br:5000/c3sl/blendb:latest
+        image: blendb
         build: .
         container_name: blendb
         environment:
-            BLENDB_DB_USER: postgres
-            BLENDB_DB_PASSWORD: passwd
-            BLENDB_DB_NAME: postgres
-            BLENDB_DB_HOST: postgres
-            BLENDB_DB_PORT: 5432
-            BLENDB_ADAPTER: postgres
             BLENDB_SCHEMA_FILE: config/config.yaml.example
             PORT: 3000
+            BLENDB_N_DB: 1
+            BLENDB_DB0_USER: postgres
+            BLENDB_DB0_NAME: postgres
+            BLENDB_DB0_PASSWORD: passwd
+            BLENDB_DB0_HOST: postgres
+            BLENDB_DB0_PORT: 5432
+            BLENDB_DB0_ADAPTER: postgres
         ports:
             - 3000:3000
         command: ["yarn","test-mode"]
diff --git a/scripts/loadTest.ts b/scripts/loadTest.ts
index 4e8fe824..e0c53a68 100644
--- a/scripts/loadTest.ts
+++ b/scripts/loadTest.ts
@@ -37,7 +37,7 @@ else{
 }
 config = ConfigParser.parse(configPath);
 
-fixture = new FixPostgres(config.connection);
+fixture = new FixPostgres(config.connections[0]);
 
 fixture.load(config.loadViews, (err) => {
     if (err) {
diff --git a/scripts/schema.ts b/scripts/schema.ts
index c8a8d39e..baef54d3 100755
--- a/scripts/schema.ts
+++ b/scripts/schema.ts
@@ -40,7 +40,7 @@ const config = ConfigParser.parse(configFile);
 const referencePath = path.dirname(configFile);
 
 const engine = new Engine(config);
-const adapter = new PostgresAdapter(config.connection);
+const adapter = new PostgresAdapter(config.connections[0]);
 
 let schema = "";
 
-- 
GitLab