Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
42b1e57
add test coverage and test coverage report to scripts
DryDish Jun 3, 2022
e30392e
add default test for all models
DryDish Jun 3, 2022
7ee4bad
add stringDateTime validator to utils
DryDish Jun 3, 2022
1560a0d
add validator to Attendance's set method
DryDish Jun 3, 2022
980e21a
add tests found in equivalence partitioning
DryDish Jun 3, 2022
33afec9
add missing tests cases with numbers and objects
DryDish Jun 3, 2022
3a9f964
continue model testing
DryDish Jun 5, 2022
aed43e1
input-validator.test.ts
ithai5 Jun 5, 2022
e8028b1
moved test to test/ folder
DryDish Jun 5, 2022
0c75a0a
made BEAUTIFUL
DryDish Jun 5, 2022
4bad622
add return types to generic service and custom result
DryDish Jun 5, 2022
2fe130d
input-validator.test.ts
ithai5 Jun 5, 2022
144dbe9
add styling to tests
DryDish Jun 5, 2022
148c2dc
remove redundant test folder
DryDish Jun 5, 2022
6dfb2e1
add some responseHandler tests
DryDish Jun 5, 2022
eb4a39c
add missing test cases to responseHandler
DryDish Jun 5, 2022
4931ce7
wip endpoint test
ithai5 Jun 5, 2022
6989a07
fix tests not communication to database
DryDish Jun 5, 2022
efb0492
Performance test docker files and routes ready to run
Astthor Jun 6, 2022
1c936f9
wip endpoint test subjects
ithai5 Jun 6, 2022
50a2aea
Delete Astthor-performance-test.txt
Astthor Jun 6, 2022
1f86a3e
gitingore mess
Astthor Jun 6, 2022
ac9c52f
Merge branch 'performance-testing' of https://github.com/kea-large-sy…
Astthor Jun 6, 2022
526806d
wip endpoint test subjects
ithai5 Jun 6, 2022
883897b
wip endpoint test subjects
ithai5 Jun 6, 2022
cf64a7a
Subject router testing db sync fix
Astthor Jun 6, 2022
1bf9329
endpoint test subjects complete
ithai5 Jun 6, 2022
e865cc5
endpoint test subjects complete
ithai5 Jun 6, 2022
f638b82
endpoint test user complete
ithai5 Jun 6, 2022
088d4db
add script changes
ithai5 Jun 6, 2022
f749cfa
Attendance router tested
Astthor Jun 6, 2022
d1f3342
fix issue in code generation, add some tests and stuff you know how it i
DryDish Jun 6, 2022
f1d429c
comment out problematic tests
DryDish Jun 6, 2022
d14d6fc
role-router test done
ithai5 Jun 6, 2022
66e3788
Merge remote-tracking branch 'origin/model-tests' into model-tests
ithai5 Jun 6, 2022
1a2b087
add missing test cases for ModelService
DryDish Jun 6, 2022
8e0c9b8
add missing validators and update package.json
DryDish Jun 6, 2022
706ab59
clean up comments in generic-service.test and rename
DryDish Jun 6, 2022
d5df311
lecture-router.test.ts
ithai5 Jun 6, 2022
76653f3
lecture-router.test.ts
ithai5 Jun 6, 2022
8537c72
add subject-service tests
DryDish Jun 6, 2022
7635b62
lecture-router.test.ts
ithai5 Jun 6, 2022
40a4829
Merge remote-tracking branch 'origin/model-tests' into model-tests
ithai5 Jun 6, 2022
4aea718
Extra check in code class service, added await in router and tested r…
Astthor Jun 6, 2022
8541538
isAuthenticated and teacherGuard tested
Astthor Jun 6, 2022
2370de0
Merge pull request #22 from kea-large-systems/performance-testing
CristiPV Jun 6, 2022
04a4058
add docker-compose and its configs
DryDish Jun 6, 2022
a18cbd3
Merge branch 'development' into model-tests
CristiPV Jun 6, 2022
9bd9864
Merge pull request #23 from kea-large-systems/model-tests
CristiPV Jun 6, 2022
fd42552
Add .circleci/config.yml
DryDish Jun 6, 2022
8ff3d51
Merge remote-tracking branch 'origin/development' into circleci-edito…
DryDish Jun 6, 2022
2b7862d
Updated config.yml
DryDish Jun 6, 2022
f4bf48d
dockercompose cahnges
DryDish Jun 6, 2022
70c86ab
dockercompose cahnges
DryDish Jun 6, 2022
27280cd
dockercompose cahnges
DryDish Jun 6, 2022
44d8c7f
dockercompose cahnges
DryDish Jun 6, 2022
a8d9176
Updated config.yml
DryDish Jun 6, 2022
8f63322
Updated config.yml
DryDish Jun 6, 2022
0804b2c
Updated config.yml
DryDish Jun 6, 2022
bf95df9
update docker-compose
DryDish Jun 6, 2022
a10cdbf
Merge remote-tracking branch 'origin/circleci-editor/669/main' into c…
DryDish Jun 6, 2022
f9c7369
Updated config.yml
DryDish Jun 6, 2022
6a58054
Updated config.yml
DryDish Jun 6, 2022
6ceb79d
Updated config.yml
DryDish Jun 6, 2022
4a55cb6
Updated config.yml
DryDish Jun 6, 2022
765346a
Updated config.yml
DryDish Jun 6, 2022
8fe2550
Updated config.yml
DryDish Jun 6, 2022
1af251f
Updated config.yml
DryDish Jun 6, 2022
b14b86d
Updated config.yml
DryDish Jun 6, 2022
da5aa48
change healthcheck to be a timer
DryDish Jun 6, 2022
3cbdef9
Updated config.yml
DryDish Jun 6, 2022
3f726fe
Updated config.yml
DryDish Jun 6, 2022
1e4850e
Updated config.yml
DryDish Jun 6, 2022
e64b9ce
Updated config.yml
DryDish Jun 6, 2022
e44b139
Updated config.yml
DryDish Jun 6, 2022
39b673b
remove open handles
DryDish Jun 6, 2022
860a8da
Updated config.yml
DryDish Jun 6, 2022
d07879d
Updated config.yml
DryDish Jun 6, 2022
fd7c60c
increase timeout window
DryDish Jun 6, 2022
afb8840
change myslq sec settings
DryDish Jun 6, 2022
c07a3f6
fix timeout window
DryDish Jun 6, 2022
c323a11
Updated config.yml
DryDish Jun 6, 2022
2924fa7
Updated config.yml
DryDish Jun 6, 2022
3ad4efd
Updated config.yml
DryDish Jun 6, 2022
7291455
Updated config.yml
DryDish Jun 7, 2022
f75e283
change network mode
DryDish Jun 7, 2022
dc149e4
Updated config.yml
DryDish Jun 7, 2022
7dd70d6
Merge pull request #24 from kea-large-systems/circleci-editor/669/main
CristiPV Jun 7, 2022
ea5e90f
Circleci editor/669/main (#26)
DryDish Jun 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 18 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,24 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
# The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
# Orbs reduce the amount of configuration required for common tasks.
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
node: circleci/node@4.7
executors:
runner:
machine:
image: "ubuntu-2004:current"
docker_layer_caching: true

jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
test:
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/node
docker:
- image: cimg/node:16.10
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
build:
executor: runner
steps:
# Checkout the code as the first step.
- checkout
# Next, the node orb's install-packages step will install the dependencies from a package.json.
# The orb install-packages step will also automatically cache them for faster future runs.
- node/install-packages:
# If you are using yarn, change the line below from "npm" to "yarn"
pkg-manager: npm
- run:
name: Run tests
command: npm test

workflows:
# Below is the definition of your workflow.
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
# CircleCI will run this workflow on every commit.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
test:
jobs:
- test
# For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines.
# - node/test
name: Test for ENV
command: |
a=123
- run:
name: Check docker compose config
command: |
docker-compose config
- run:
name: Run tests using `docker-compose`
command: |
docker-compose up --build --exit-code-from test
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,4 @@ config.js
env-config.ts

# Astthors txt notes
www-astthor-notes.txt
authAstthorTesting.routes.ts
Astthor-performance-test.txt
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3'

services:
test:
build:
context: .
dockerfile: ./docker/app/Dockerfile
network_mode: "host"
environment:
- PORT=$PORT
- DATABASE=$DATABASE
- DB_USERNAME=$DB_USERNAME
- DB_PASSWORD=$DB_PASSWORD
- DB_HOST=$DB_HOST
- MICROSOFT_CLIENT_ID=$MICROSOFT_CLIENT_ID
- MICROSOFT_CLIENT_SECRET=$MICROSOFT_CLIENT_SECRET
- MICROSOFT_CALL_BACK_URL=$MICROSOFT_CALL_BACK_URL
- MICROSOFT_SCOPE=$MICROSOFT_SCOPE
- SESSION_SECRET=$SESSION_SECRET
- SESSION_RESAVE=$SESSION_RESAVE
- SESSION_SAVEUNINITIALIZED=$SESSION_SAVEUNINITIALIZED
- SESSION_COOKIE_SECURE=$SESSION_COOKIE_SECURE
- FRONTEND_APP=$FRONTEND_APP
# ports:
# - 4200:4200
depends_on:
mysql:
condition: service_healthy
mysql:
image: mysql:latest
network_mode: "host"
environment:
- MYSQL_ROOT_PASSWORD=$DB_PASSWORD
- MYSQL_DATABASE=$DATABASE
- MYSQL_USER=$DB_USERNAME
- MYSQL_PASSWORD=$DB_PASSWORD
# ports:
# - 3306:3306
security_opt:
- seccomp:unconfined
healthcheck:
test: ["CMD-SHELL", "echo 'HELLO WORLD' "]
start_period: 60s
23 changes: 23 additions & 0 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Lightweight environment with node pre-installed
FROM node:alpine AS builder

# Directory to work in the container
WORKDIR /app

# Copy package.json to the root of the WORKDIR
COPY package.json ./

# Copy all files different to local machine to container
# The way caching works, any changes to any files will force everything under it to
# rebuild all subsequent steps
COPY . .

# Run npm install inside container
# --legacy-peer-deps This line is currently required for the dependencies to install
# Should be tested once in a while and removed when possible, as package maintainers
# updated their dependencies to the new automated system.
RUN npm ci

# Execute this command in the docker container

CMD ["npm", "test"]
1 change: 1 addition & 0 deletions docker/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mysql:latest
98 changes: 49 additions & 49 deletions docs/population-script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,66 @@ INSERT INTO roles VALUES(2, "student");
-- Users ---------------------------------------------------------------------

-- Teachers
INSERT INTO users VALUES(1, 'Teacher Bob', 'bob@kea.dk', 1);
INSERT INTO users VALUES(1, 'Teacher Bob', 'alex320i@stud.kea.dk', 1);
INSERT INTO users VALUES(2, 'Teacher Ann', 'ann@kea.dk', 1);
INSERT INTO users VALUES(3, 'Teacher Won', 'won@kea.dk', 1);
INSERT INTO users VALUES(4, 'Teacher Tom', 'tom@kea.dk', 1);

-- Students
INSERT INTO users VALUES(6, 'Student Ada', 'ada@stud.kea.dk', 2);
INSERT INTO users VALUES(7, 'Student Pam', 'pam@stud.kea.dk', 2);
INSERT INTO users VALUES(8, 'Student Kit', 'kit@stud.kea.dk', 2);
INSERT INTO users VALUES(9, 'Student Zoe', 'zoe@stud.kea.dk', 2);
INSERT INTO users VALUES(10, 'Student Ray', 'ray@stud.kea.dk', 2);
INSERT INTO users VALUES(11, 'Student Alf', 'alf@stud.kea.dk', 2);
INSERT INTO users VALUES(12, 'Student Coy', 'coy@stud.kea.dk', 2);
INSERT INTO users VALUES(13, 'Student Gil', 'gil@stud.kea.dk', 2);
INSERT INTO users VALUES(6, 'Student Ada', 'cris2041@stud.kea.dk', 2);
INSERT INTO users VALUES(7, 'Student Pam', 'pam@stud.kea.dk', 2);
INSERT INTO users VALUES(8, 'Student Kit', 'kit@stud.kea.dk', 2);
INSERT INTO users VALUES(9, 'Student Zoe', 'zoe@stud.kea.dk', 2);
INSERT INTO users VALUES(10, 'Student Ray', 'ray@stud.kea.dk', 2);
INSERT INTO users VALUES(11, 'Student Alf', 'alf@stud.kea.dk', 2);
INSERT INTO users VALUES(12, 'Student Coy', 'coy@stud.kea.dk', 2);
INSERT INTO users VALUES(13, 'Student Gil', 'gil@stud.kea.dk', 2);

-- Classes ---------------------------------------------------------------------
INSERT INTO classes VALUES(1, "SW20");
INSERT INTO classes VALUES(2, "WD20");
INSERT INTO classes VALUES(3, "SW21");
INSERT INTO classes VALUES(4, "WD21");
INSERT INTO classes VALUES(5, "SW22");
INSERT INTO classes VALUES(6, "WD22");
INSERT INTO classes VALUES(1, "SW20");
INSERT INTO classes VALUES(2, "WD20");
INSERT INTO classes VALUES(3, "SW21");
INSERT INTO classes VALUES(4, "WD21");
INSERT INTO classes VALUES(5, "SW22");
INSERT INTO classes VALUES(6, "WD22");

-- Subjects --------------------------------------------------------------------
INSERT INTO subjects VALUES(1, "Testing SW20", 1, 1);
INSERT INTO subjects VALUES(2, "Testing SW21", 1, 3);
INSERT INTO subjects VALUES(3, "Testing SW22", 1, 5);
INSERT INTO subjects VALUES(4, "Web Development WD20", 2, 2);
INSERT INTO subjects VALUES(5, "Web Development WD21", 2, 4);
INSERT INTO subjects VALUES(6, "Web Development WD22", 2, 6);
INSERT INTO subjects VALUES(7, "Databases SW20", 3, 1);
INSERT INTO subjects VALUES(8, "Databases SW21", 3, 3);
INSERT INTO subjects VALUES(9, "Databases SW22", 3, 5);
INSERT INTO subjects VALUES(10, "Large Systems SW20", 4, 1);
INSERT INTO subjects VALUES(11, "Large Systems SW21", 4, 3);
INSERT INTO subjects VALUES(12, "Large Systems SW22", 4, 5);
INSERT INTO subjects VALUES(1, "Testing", 1, 1);
INSERT INTO subjects VALUES(2, "Testing", 1, 3);
INSERT INTO subjects VALUES(3, "Testing", 1, 5);
INSERT INTO subjects VALUES(4, "Web Development", 2, 2);
INSERT INTO subjects VALUES(5, "Web Development", 2, 4);
INSERT INTO subjects VALUES(6, "Web Development", 2, 6);
INSERT INTO subjects VALUES(7, "Databases", 3, 1);
INSERT INTO subjects VALUES(8, "Databases", 3, 3);
INSERT INTO subjects VALUES(9, "Databases", 3, 5);
INSERT INTO subjects VALUES(10, "Large Systems", 4, 1);
INSERT INTO subjects VALUES(11, "Large Systems", 4, 3);
INSERT INTO subjects VALUES(12, "Large Systems", 4, 5);

-- Lectures --------------------------------------------------------------------
INSERT INTO lectures VALUES(1, "Not Learning Microservices 1", NOW(), (NOW() + interval 90 minute), 12);
INSERT INTO lectures VALUES(2, "Not Learning Microservices 2", (NOW() + interval 90 minute), (NOW() + interval 180 minute), 12);
INSERT INTO lectures VALUES(3, "Not Learning Microservices 3", (NOW() + interval 180 minute), (NOW() + interval 270 minute), 12);
INSERT INTO lectures VALUES(4, "NoSQL 1", NOW(), (NOW() + interval 90 minute), 9);
INSERT INTO lectures VALUES(5, "NoSQL 2", (NOW() + interval 90 minute), (NOW() + interval 180 minute), 9);
INSERT INTO lectures VALUES(6, "NoSQL 3", (NOW() + interval 180 minute), (NOW() + interval 270 minute), 9);
INSERT INTO lectures VALUES(7, "Unit Testing", NOW(), (NOW() + interval 90 minute), 3);
INSERT INTO lectures VALUES(8, "Unit Testing", (NOW() + interval 90 minute), (NOW() + interval 180 minute), 3);
INSERT INTO lectures VALUES(9, "Unit Testing", (NOW() + interval 180 minute), (NOW() + interval 270 minute), 3);
INSERT INTO lectures VALUES(1, "Not Learning Microservices 1", '2022-06-06 13:14', ('2022-06-06 13:14' + interval 90 minute), 12);
INSERT INTO lectures VALUES(2, "Not Learning Microservices 2", '2022-06-06 13:18', ('2022-06-06 13:18' + interval 180 minute), 12);
INSERT INTO lectures VALUES(3, "Not Learning Microservices 3", '2022-06-06 13:22', ('2022-06-06 13:22' + interval 270 minute), 12);
INSERT INTO lectures VALUES(4, "NoSQL 1", '2022-06-06 13:26', ('2022-06-06 13:26' + interval 90 minute), 9);
INSERT INTO lectures VALUES(5, "NoSQL 2", '2022-06-06 13:30', ('2022-06-06 13:30' + interval 180 minute), 9);
INSERT INTO lectures VALUES(6, "NoSQL 3", '2022-06-06 13:34', ('2022-06-06 13:34' + interval 270 minute), 9);
INSERT INTO lectures VALUES(7, "Unit Testing", '2022-06-06 13:40', ('2022-06-06 13:40' + interval 90 minute), 3);
INSERT INTO lectures VALUES(8, "Unit Testing", '2022-06-06 13:44', ('2022-06-06 13:44' + interval 180 minute), 3);
INSERT INTO lectures VALUES(9, "Unit Testing", '2022-06-06 13:50', ('2022-06-06 13:50' + interval 270 minute), 3);

-- Attendance -------------------------------------------------------------------
INSERT INTO attendances VALUES(1, NOW(), 1, 5);
INSERT INTO attendances VALUES(2, NOW(), 1, 6);
INSERT INTO attendances VALUES(3, NOW(), 1, 7);
INSERT INTO attendances VALUES(4, NOW(), 1, 8);
INSERT INTO attendances VALUES(5, NOW(), 1, 9);
INSERT INTO attendances VALUES(6, (NOW() + interval 95 minute), 2, 5);
INSERT INTO attendances VALUES(7, (NOW() + interval 96 minute), 2, 6);
INSERT INTO attendances VALUES(8, (NOW() + interval 97 minute), 2, 7);
INSERT INTO attendances VALUES(9, (NOW() + interval 98 minute), 2, 8);
INSERT INTO attendances VALUES(10, (NOW() + interval 95 minute), 2, 5);
INSERT INTO attendances VALUES(11, (NOW() + interval 185 minute), 2, 5);
INSERT INTO attendances VALUES(12, (NOW() + interval 186 minute), 2, 6);
INSERT INTO attendances VALUES(13, (NOW() + interval 187 minute), 2, 7);
INSERT INTO attendances VALUES(1, '2022-06-06 13:14', 1, 5);
INSERT INTO attendances VALUES(2, '2022-06-06 13:14', 1, 6);
INSERT INTO attendances VALUES(3, '2022-06-06 13:14', 1, 7);
INSERT INTO attendances VALUES(4, '2022-06-06 13:14', 1, 8);
INSERT INTO attendances VALUES(5, '2022-06-06 13:14', 1, 9);
INSERT INTO attendances VALUES(6, '2022-06-06 13:14', 2, 5);
INSERT INTO attendances VALUES(7, '2022-06-06 13:14', 2, 6);
INSERT INTO attendances VALUES(8, '2022-06-06 13:14', 2, 7);
INSERT INTO attendances VALUES(9, '2022-06-06 13:14', 2, 8);
INSERT INTO attendances VALUES(10, '2022-06-06 13:14', 2, 5);
INSERT INTO attendances VALUES(11, '2022-06-06 13:14', 2, 5);
INSERT INTO attendances VALUES(12, '2022-06-06 13:14', 2, 6);
INSERT INTO attendances VALUES(13, '2022-06-06 13:14', 2, 7);

1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
preset: "ts-jest",
testEnvironment: "node",
modulePathIgnorePatterns: ["build"],
testTimeout: 15000
};
Loading