Skip to content

Commit

Permalink
fix: Change env variables according to cht pipeline updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrablaj committed Feb 23, 2024
1 parent c8f41db commit 33c7a9f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
16 changes: 8 additions & 8 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
COMPOSE_PROJECT_NAME=pipeline

# postgrest and postgresql: required environment variables for 'gamma', prod and 'local'
POSTGRES_USER=root
POSTGRES_PASSWORD=supercoolpassword
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=data
POSTGRES_TABLE=couchdb # for dbt use only
POSTGRES_SCHEMA=v1
POSTGRES_TABLE=medic # for dbt use only

# dbt: required environment variables for 'gamma', 'prod' and 'local'
DBT_POSTGRES_USER=dbt_user
DBT_POSTGRES_PASSWORD=supercoolpassword
DBT_POSTGRES_USER=postgres
DBT_POSTGRES_PASSWORD=postgres
DBT_POSTGRES_SCHEMA=dbt
DBT_POSTGRES_HOST=postgres # Your postgres instance IP or endpoint in "prod".
CHT_PIPELINE_BRANCH_URL="https://github.com/medic/cht-pipeline.git#main"

# couchdb and logstash: required environment variables for 'gamma', 'prod' and 'local'
COUCHDB_USER=test
COUCHDB_PASSWORD=test
COUCHDB_DBS="couchdb couchdb_sentinel" # space separated list of databases you want to sync e.g "medic medic_sentinel"
COUCHDB_USER=medic
COUCHDB_PASSWORD=password
COUCHDB_DBS="medic" # space separated list of databases you want to sync e.g "medic medic_sentinel"
COUCHDB_HOST=couchdb
COUCHDB_PORT=5984
COUCHDB_SECURE=false
8 changes: 4 additions & 4 deletions scripts/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "dotenv/config"
import path from "path";

export const COUCHDB_DBS = process.env.COUCHDB_DBS || "couchdb";
export const COUCHDB_DBS = process.env.COUCHDB_DBS || "medic";

export const POSTGRES = {
username: process.env.POSTGRES_USER || 'root',
password: process.env.POSTGRES_PASSWORD || 'supercoolpassword',
db: process.env.POSTGRES_DB || 'db',
username: process.env.POSTGRES_USER || 'postgres',
password: process.env.POSTGRES_PASSWORD || 'postgres',
db: process.env.POSTGRES_DB || 'data',
table: process.env.POSTGRES_TABLE,
schema: process.env.POSTGRES_SCHEMA
};
Expand Down
13 changes: 8 additions & 5 deletions tests/e2e-test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Client } from "ts-postgres";
import { rootConnect } from "./postgres-utils";
import request from 'supertest';
import { POSTGRES, DBT_POSTGRES } from "../scripts/config";

describe("Main workflow Test Suite", () => {
Expand All @@ -10,14 +9,18 @@ describe("Main workflow Test Suite", () => {

afterAll(async () => await client.end());

it("should have data in postgres main tables", async () => {
it("should have data in postgres medic table", async () => {
let couchdbTableResult = await client.query("SELECT * FROM " + POSTGRES.schema + "." + POSTGRES.table);
expect(couchdbTableResult.rows.length).toBeGreaterThan(0);
});

let dataRecordTableResult = await client.query("SELECT * FROM " + DBT_POSTGRES.schema + ".data_record");
expect(dataRecordTableResult.rows.length).toBeGreaterThan(0);

it("should have data in postgres person table", async () => {
let personTableResult = await client.query("SELECT * FROM " + DBT_POSTGRES.schema + ".person");
expect(personTableResult.rows.length).toBeGreaterThan(0);
});

it("should have data in postgres data_record table", async () => {
let dataRecordTableResult = await client.query("SELECT * FROM " + DBT_POSTGRES.schema + ".data_record");
expect(dataRecordTableResult.rows.length).toBeGreaterThan(0);
});
});

0 comments on commit 33c7a9f

Please sign in to comment.