Skip to content

Commit d241a2b

Browse files
committed
use random ids for test jobs
1 parent f4f4592 commit d241a2b

23 files changed

+35
-35
lines changed

test/project/project.nodejs.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ProjectJob } from "../../src/tasks/jobs/project"
55
describe('project - nodejs', () => {
66
it('nodejs project submits correctly', async () => {
77
const result = await execute(new ProjectJob({
8-
id: 4,
8+
id: Math.floor(Math.random() * 1000),
99
lang: 'nodejs',
1010
source: 'https://minio.cb.lk/hackerblocks/sample-solution.zip',
1111
problem: 'https://minio.cb.lk/hackerblocks/sample-problem_2.zip',

test/project/project.python.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ProjectJob } from "../../src/tasks/jobs/project"
55
describe('project - python', () => {
66
it('nodejs project submits correctly', async () => {
77
const result = await execute(new ProjectJob({
8-
id: 5,
8+
id: Math.floor(Math.random() * 1000),
99
lang: 'python',
1010
source: 'https://minio.cb.lk/hackerblocks/python-solution.zip',
1111
problem: 'https://minio.cb.lk/hackerblocks/python-problem.zip',

test/run/run.c.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
55
describe('run - c', () => {
66
it('.c file runs correctly', async () => {
77
const runResult = await execute(new RunJob({
8-
id: 19,
8+
id: Math.floor(Math.random() * 1000),
99
lang: 'c',
1010
source: (new Buffer(`
1111
#include <stdio.h>

test/run/run.cpp.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - cpp', () => {
77
it('.cpp file runs correctly', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 20,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'cpp',
1111
source: (new Buffer(`
1212
#include <iostream>

test/run/run.csharp.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - csharp', () => {
77
it('.cs file runs correctly', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 21,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'csharp',
1111
source: (new Buffer(`
1212
using System;

test/run/run.java8.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - java8', () => {
77
it('.java file runs correctly (Java8)', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 22,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'java8',
1111
source: (new Buffer(`
1212
import java.util.Scanner;

test/run/run.nodejs10.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
55
describe('run - nodejs10', () => {
66
it('.js file runs correctly (NodeJS 6)', async () => {
77
const runResult = await execute(new RunJob({
8-
id: 24,
8+
id: Math.floor(Math.random() * 1000),
99
lang: 'nodejs10',
1010
source: (new Buffer(`
1111
var readline = require('readline');

test/run/run.nodejs8.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - nodejs8', () => {
77
it('.js file runs correctly (NodeJS 8)', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 25,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'nodejs8',
1111
source: (new Buffer(`
1212
const readline = require('readline');

test/run/run.py2.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - py2', () => {
77
it('.py file runs correctly (Python 2.7)', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 23,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'py2',
1111
source: (new Buffer(`
1212
inp = raw_input()

test/run/run.py3.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - py3', () => {
77
it('.py file runs correctly (Python 3.0)', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 26,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'py3',
1111
source: (new Buffer(`
1212
inp = input()

test/run/run.ruby.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {RunJob} from '../../src/tasks/jobs/run'
66
describe('run - ruby', () => {
77
it('.rb file runs correctly', async () => {
88
const runResult = await execute(new RunJob({
9-
id: 27,
9+
id: Math.floor(Math.random() * 1000),
1010
lang: 'ruby',
1111
source: (new Buffer(`
1212
puts "Hello " + gets.to_s

test/scenarios/projectScenario.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ProjectScenario from '../../src/tasks/scenarios/project'
88
describe('Project Scenario', () => {
99
it('should setup', async () => {
1010
const job: ProjectJob = new ProjectJob({
11-
id: 4,
11+
id: Math.floor(Math.random() * 1000),
1212
lang: 'nodejs',
1313
source: 'https://minio.cb.lk/hackerblocks/sample-solution.zip',
1414
problem: 'https://minio.cb.lk/hackerblocks/sample-problem_2.zip',

test/scenarios/runScenario.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Run Scenario', () => {
1212
const stdin = 'World'
1313

1414
const job: RunJob = {
15-
id: 1,
15+
id: Math.floor(Math.random() * 1000),
1616
source: (new Buffer(source)).toString('base64'),
1717
lang: 'py3',
1818
timelimit: 5,

test/scenarios/submissionScenario.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ describe('Submission Scenario', () => {
1111
const source = 'print("Hello World")'
1212

1313
const job: SubmitJob = {
14-
id: 1,
14+
id: Math.floor(Math.random() * 1000),
1515
source: (new Buffer(source)).toString('base64'),
1616
lang: 'py3',
1717
timelimit: 5,
1818
scenario: 'submit',
1919
testcases: [{
20-
id: 122,
20+
id: Math.floor(Math.random() * 1000),
2121
input: 'https://minio.cb.lk/public/input',
2222
output: 'https://minio.cb.lk/public/output'
2323
}]

test/submission/submit.c.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ describe('submit - c', () => {
1616
`
1717

1818
const submitResult = await execute(new SubmitJob({
19-
id: 1,
19+
id: Math.floor(Math.random() * 1000),
2020
lang: 'c',
2121
source: (new Buffer(source)).toString('base64'),
2222
scenario: 'submit',
2323
testcases: [{
24-
id: 1,
24+
id: Math.floor(Math.random() * 1000),
2525
input: 'https://minio.cb.lk/public/input',
2626
output: 'https://minio.cb.lk/public/output'
2727
}]

test/submission/submit.cpp.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ describe('submit - cpp', () => {
1616
}`
1717

1818
const submitResult = await execute(new SubmitJob({
19-
id: 1,
19+
id: Math.floor(Math.random() * 1000),
2020
lang: 'cpp',
2121
source: (new Buffer(source)).toString('base64'),
2222
scenario: 'submit',
2323
testcases: [{
24-
id: 1,
24+
id: Math.floor(Math.random() * 1000),
2525
input: 'https://minio.cb.lk/public/input',
2626
output: 'https://minio.cb.lk/public/output'
2727
}]
@@ -38,12 +38,12 @@ describe('submit - cpp', () => {
3838
using namespace std;
3939
int main () {`
4040
const submitResult = await execute(new SubmitJob({
41-
id: 2,
41+
id: Math.floor(Math.random() * 1000),
4242
lang: 'cpp',
4343
source: (new Buffer(source)).toString('base64'),
4444
scenario: 'submit',
4545
testcases: [{
46-
id: 1,
46+
id: Math.floor(Math.random() * 1000),
4747
input: 'https://minio.cb.lk/public/input',
4848
output: 'https://minio.cb.lk/public/output'
4949
}]

test/submission/submit.csharp.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ describe('submit - csharp', () => {
1414
}
1515
`
1616
const submitResult = await execute(new SubmitJob({
17-
id: 3,
17+
id: Math.floor(Math.random() * 1000),
1818
lang: 'csharp',
1919
source: (new Buffer(source)).toString('base64'),
2020
scenario: 'submit',
2121
testcases: [{
22-
id: 1,
22+
id: Math.floor(Math.random() * 1000),
2323
input: 'https://minio.cb.lk/public/input',
2424
output: 'https://minio.cb.lk/public/output'
2525
}]

test/submission/submit.java8.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ describe('submit - java8', () => {
1717
`
1818

1919
const submitResult = await execute(new SubmitJob({
20-
id: 4,
20+
id: Math.floor(Math.random() * 1000),
2121
lang: 'java8',
2222
source: (new Buffer(source)).toString('base64'),
2323
scenario: 'submit',
2424
testcases: [{
25-
id: 1,
25+
id: Math.floor(Math.random() * 1000),
2626
input: 'https://minio.cb.lk/public/input',
2727
output: 'https://minio.cb.lk/public/output'
2828
}]

test/submission/submit.nodejs10.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ describe('submit - nodejs10', () => {
1818
`
1919

2020
const submitResult = await execute(new SubmitJob({
21-
id: 6,
21+
id: Math.floor(Math.random() * 1000),
2222
lang: 'nodejs10',
2323
source: (new Buffer(source)).toString('base64'),
2424
scenario: 'submit',
2525
testcases: [{
26-
id: 1,
26+
id: Math.floor(Math.random() * 1000),
2727
input: 'https://minio.cb.lk/public/input',
2828
output: 'https://minio.cb.lk/public/output'
2929
}]

test/submission/submit.nodejs8.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ describe('submit - nodejs8', () => {
1818
`
1919

2020
const submitResult = await execute(new SubmitJob({
21-
id: 5,
21+
id: Math.floor(Math.random() * 1000),
2222
lang: 'nodejs8',
2323
source: (new Buffer(source)).toString('base64'),
2424
scenario: 'submit',
2525
testcases: [{
26-
id: 1,
26+
id: Math.floor(Math.random() * 1000),
2727
input: 'https://minio.cb.lk/public/input',
2828
output: 'https://minio.cb.lk/public/output'
2929
}]

test/submission/submit.py2.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ print("Hello " + inp)
1111
`
1212

1313
const submitResult = await execute(new SubmitJob({
14-
id: 7,
14+
id: Math.floor(Math.random() * 1000),
1515
lang: 'py2',
1616
source: (new Buffer(source)).toString('base64'),
1717
scenario: 'submit',
1818
testcases: [{
19-
id: 1,
19+
id: Math.floor(Math.random() * 1000),
2020
input: 'https://minio.cb.lk/public/input',
2121
output: 'https://minio.cb.lk/public/output'
2222
}]

test/submission/submit.py3.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ print("Hello " + inp)
1111
`
1212

1313
const submitResult = await execute(new SubmitJob({
14-
id: 8,
14+
id: Math.floor(Math.random() * 1000),
1515
lang: 'py3',
1616
source: (new Buffer(source)).toString('base64'),
1717
scenario: 'submit',
1818
testcases: [{
19-
id: 1,
19+
id: Math.floor(Math.random() * 1000),
2020
input: 'https://minio.cb.lk/public/input',
2121
output: 'https://minio.cb.lk/public/output'
2222
}]

test/submission/submit.ruby.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ describe('submit - ruby', () => {
1010
`
1111

1212
const submitResult = await execute(new SubmitJob({
13-
id: 9,
13+
id: Math.floor(Math.random() * 1000),
1414
lang: 'ruby',
1515
source: (new Buffer(source)).toString('base64'),
1616
scenario: 'submit',
1717
testcases: [{
18-
id: 1,
18+
id: Math.floor(Math.random() * 1000),
1919
input: 'https://minio.cb.lk/public/input',
2020
output: 'https://minio.cb.lk/public/output'
2121
}]

0 commit comments

Comments
 (0)