File tree Expand file tree Collapse file tree 4 files changed +8
-48
lines changed Expand file tree Collapse file tree 4 files changed +8
-48
lines changed Original file line number Diff line number Diff line change @@ -21,24 +21,10 @@ jobs:
21
21
command : |
22
22
docker-compose build
23
23
- run :
24
- name : Docker Compose
24
+ name : Run Test Docker Compose
25
25
command : |
26
- docker-compose -p judgecompose up -d
26
+ docker-compose --file docker-compose-test.yml up --abort-on-container-exit
27
27
- run :
28
- name : Seed Language Data
29
- command : |
30
- docker exec judgecompose_api_1 scripts/wait-for-it.sh -t 180 api:3737 -- npm run seedlangs
31
- - run :
32
- name : Run Tests
33
- command : |
34
- mkdir -p coverage
35
- docker kill judgecompose_api_1
36
- docker run -t --env-file test.env \
37
- -v "$PWD/coverage:/usr/src/judge-api/coverage" \
38
- --network judgecompose_default \
39
- --env "DEBUG=test:* JUDGEAPI_HOST=api JUDGEAPI_PORT=2222" codingblocks/judge-api \
40
- npm run cover
41
- - run :
42
- name : Submit Coverage
28
+ name : Submit Code Coverage
43
29
command : bash <(curl -s https://codecov.io/bash)
44
30
Original file line number Diff line number Diff line change @@ -19,20 +19,9 @@ before_install:
19
19
20
20
install :
21
21
- docker-compose build
22
- - docker-compose -p judgecompose up -d
23
-
24
- before_script :
25
- - docker exec judgecompose_api_1 scripts/wait-for-it.sh -t 180 api:3737 -- npm run seedlangs
26
22
27
23
script :
28
- - docker kill judgecompose_api_1
29
- - mkdir -p coverage
30
- - |
31
- docker run -t --env-file test.env \
32
- -v "$PWD/coverage:/usr/src/judge-api/coverage" \
33
- --network judgecompose_default \
34
- --env "DEBUG=test:* JUDGEAPI_HOST=api JUDGEAPI_PORT=2222" codingblocks/judge-api \
35
- npm run cover
24
+ - docker-compose --file docker-compose-test.yml up --abort-on-container-exit
36
25
37
26
after_success :
38
27
- bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change @@ -19,9 +19,12 @@ services:
19
19
api :
20
20
build : .
21
21
image : codingblocks/judge-api
22
+ volumes :
23
+ - ./coverage:/usr/src/judge-api/coverage
22
24
depends_on :
23
25
- postgres
24
26
ports :
25
27
- " 3737:3737"
26
28
env_file :
27
29
- test.env
30
+ command : ./scripts/wait-for-it.sh -t 180 postgres:5432 -- ./scripts/wait-for-it.sh -t 180 rabbitmq:5672 -- npm run cover
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import DB from '../../src/models';
3
3
import express = require( 'express' ) ;
4
4
import { Router } from 'express' ;
5
5
import * as utils from '../utils/utils' ;
6
-
6
+ import ProjectController from '../../src/routes/api/project/controller' ;
7
7
8
8
const chai = require ( 'chai' ) ;
9
9
const chaiHttp = require ( 'chai-http' ) ;
@@ -62,24 +62,6 @@ describe('POST api/project', () => {
62
62
expect ( res . body . err . message ) . to . equal ( '"lang" is required' ) ;
63
63
} ) ;
64
64
65
- it ( 'should throw 400 error for incorrect language' , async ( ) => {
66
- const params = {
67
- lang : 'abcd' ,
68
- problem : 'https://minio.cb.lk/public/input' ,
69
- submission : 'https://minio.cb.lk/public/input' ,
70
- submissionDirs : 'src' ,
71
- mode : 'sync' ,
72
- timelimit : 1
73
- } ;
74
-
75
- const res = await chai . request ( app ) . post ( `/api/project` ) . set ( {
76
- Authorization : 'Bearer 7718330d2794406c980bdbded6c9dc1d' ,
77
- Accept : 'application/json'
78
- } ) . send ( params ) ;
79
-
80
- expect ( res . status ) . to . equal ( 400 ) ;
81
- } ) ;
82
-
83
65
it ( 'should throw 400 error for problem missing' , async ( ) => {
84
66
const params = {
85
67
lang : 'node' ,
You can’t perform that action at this time.
0 commit comments