Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:uka17/peon into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
uka17 committed Dec 14, 2021
2 parents f4e9f6c + eef698d commit d9a5777
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 14 deletions.
46 changes: 40 additions & 6 deletions .github/workflows/build-test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: build-test

on:
push:
Expand Down Expand Up @@ -34,32 +34,49 @@ jobs:
run: |
apt-get update
apt-get install --yes postgresql-client
- uses: actions/checkout@v2
- name: Checkout peon
uses: actions/checkout@v2
with:
repository: uka17/peon
path: peon

- name: Checkout peon-web
uses: actions/checkout@v2
with:
repository: uka17/peon-web
path: peon-web
- name: Create peon DB
run: psql -h postgres -p 5432 -U postgres -c 'create database peon'
env:
PGPASSWORD: test
- name: Structure of peon DB
run: psql -h postgres -p 5432 -U postgres -d peon -f "$GITHUB_WORKSPACE/dev_scripts/peon.sql"
run: psql -h postgres -p 5432 -U postgres -d peon -f "$GITHUB_WORKSPACE/peon/dev_scripts/peon.sql"
env:
PGPASSWORD: test
- name: Populate refs of peon DB
run: psql -h postgres -p 5432 -U postgres -d peon -f "$GITHUB_WORKSPACE/dev_scripts/refsCreation.sql"
run: psql -h postgres -p 5432 -U postgres -d peon -f "$GITHUB_WORKSPACE/peon/dev_scripts/refsCreation.sql"
env:
PGPASSWORD: test
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
cache-dependency-path: peon/package-lock.json
- name: Install, build and test peon
run: npm ci
working-directory: ./peon
- run: npm run build --if-present
working-directory: ./peon
- run: npm test
working-directory: ./peon
env:
DB_CONNECTION: "postgresql://postgres:test@postgres:5432/peon"
PORT: 8080
APP_ENV: "qa"
TEST_MODE: "quick"
- run: npm run coverage
working-directory: ./peon
env:
DB_CONNECTION: "postgresql://postgres:test@postgres:5432/peon"
PORT: 8080
Expand All @@ -68,4 +85,21 @@ jobs:
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ github.workspace }}/coverage/lcov.info
base-path: ./peon
path-to-lcov: ${{ github.workspace }}/peon/coverage/lcov.info
- name: Install, build and test web-peon
run: npm ci
working-directory: ./peon-web
- name: Launch peon-api
run: npm run dev-srv &
working-directory: ./peon
env:
DB_CONNECTION: "postgresql://postgres:test@postgres:5432/peon"
PORT: 8080
APP_ENV: "qa"
- name: Launch web-peon
run: npm run start &
working-directory: ./peon-web
- name: E2E tests
run: npm run ntest
working-directory: ./peon-web
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Web based SQL job executor

[![Coverage Status](https://coveralls.io/repos/github/uka17/peon/badge.svg?)](https://coveralls.io/github/uka17/peon)
[![Build Status](https://travis-ci.org/uka17/peon.svg?branch=develop)](https://travis-ci.org/uka17/peon)
[![Coverage Status](https://coveralls.io/repos/github/uka17/peon/badge.svg?branch=develop)](https://coveralls.io/github/uka17/peon?branch=develop)
![Build Status](https://github.com/uka17/peon/actions/workflows/build-test-coverage.yml/badge.svg)

## SQL job executor tool

Expand Down
4 changes: 2 additions & 2 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default {
//===System settings
logLevel: "info",
logDir: "../log/app.log",
enableDebugOutput: process.env.APP_ENV === "test",
skipLongTests: process.env.TEST_MODE !== "quick",
enableDebugOutput: process.env.APP_ENV === "qa",
skipLongTests: process.env.TEST_MODE === "quick",
passwordRegExp: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/gm,
emailRegExp: /.+@.+\..+/i,
//===Cookie and session
Expand Down
7 changes: 4 additions & 3 deletions test/classes/job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ describe("1 job class", function () {
});
it("1.11.1 1-minute execution test. Create connection, create 21 jobs, wait 1 minutes, check if records were created in DB", async function () {
//config.skipLongTests = false;
if (process.env.SKIP_LONG) {
if (config.skipLongTests) {
this.skip();
} else {
const numberOfJobs = 20;
const minutes = 1;

let connBody = process.env.APP_ENV === "qa" ? testData.execution.connectionQa : testData.execution.connectionLocal;
const connection = new Connection(
testData.execution.connection as ConnectionBody
connBody as ConnectionBody
);
await connection.save(config.testUser);

Expand Down Expand Up @@ -521,6 +521,7 @@ describe("1 job class", function () {
"text": `SELECT count(id) FROM public."sysAbyss" where "text" like '%${uid}%'`,
};
executeSysQuery(query, (err, result) => {
console.log(err, result)
if (result.rows)
resolve(
(result.rows[0] as unknown as Record<string, unknown>)
Expand Down
12 changes: 11 additions & 1 deletion test/data/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export default {
},

execution: {
connection: {
connectionLocal: {
"name": "Psg-conn",
"host": "172.18.0.2",
//"host": "127.0.0.1", //stupid Win docker can not provide access to postgres without port exposing to localhost
Expand All @@ -300,6 +300,16 @@ export default {
"type": "postgresql",
"database": "peon",
},
connectionQa: {
"name": "Psg-conn",
"host": "postgres",
"port": 5432,
"enabled": true,
"login": "postgres",
"password": "test",
"type": "postgresql",
"database": "peon",
},
job: {
"name": "Test job",
"description": "Job created for testing massive execution",
Expand Down

0 comments on commit d9a5777

Please sign in to comment.