|
@@ 279-302 (lines=24) @@
|
| 276 |
|
stud = create_user(get_student_dict(i)) |
| 277 |
|
self.course.participants.add(stud.profile) |
| 278 |
|
self.course.save() |
| 279 |
|
sf = create_submission_file() |
| 280 |
|
subs.append(create_validatable_submission( |
| 281 |
|
stud, self.validated_assignment, sf)) |
| 282 |
|
|
| 283 |
|
# Span a number of threads, each triggering the executor |
| 284 |
|
# This only creates a real test case if executor serialization |
| 285 |
|
# is off (see tests/executor.cfg) |
| 286 |
|
return_codes = utils.run_parallel(len(subs), self._run_executor) |
| 287 |
|
self.assertEqual( |
| 288 |
|
len(list(filter((lambda x: x is True), return_codes))), |
| 289 |
|
len(subs)) |
| 290 |
|
|
| 291 |
|
for sub in subs: |
| 292 |
|
results = SubmissionTestResult.objects.filter( |
| 293 |
|
kind=SubmissionTestResult.VALIDITY_TEST |
| 294 |
|
) |
| 295 |
|
self.assertEqual(NUM_PARALLEL, len(results)) |
| 296 |
|
self.assertNotEqual(0, len(results[0].result)) |
| 297 |
|
|
| 298 |
|
def test_too_long_validation(self): |
| 299 |
|
grading = create_pass_fail_grading() |
| 300 |
|
assignment = create_validated_assignment( |
| 301 |
|
self.course, grading, "/submfiles/validation/d000fff/", "validator_run.py") |
| 302 |
|
assignment.attachment_test_timeout = 1 |
| 303 |
|
assignment.save() |
| 304 |
|
sf = create_submission_file("/submfiles/validation/d000fff/helloworld.c") |
| 305 |
|
sub = create_validatable_submission( |
|
@@ 259-277 (lines=19) @@
|
| 256 |
|
|
| 257 |
|
def test_register_executor_explicit(self): |
| 258 |
|
machine_count = TestMachine.objects.all().count() |
| 259 |
|
assert(self._register_executor().pk) |
| 260 |
|
self.assertEqual(machine_count + 1, TestMachine.objects.all().count()) |
| 261 |
|
|
| 262 |
|
@override_settings(JOB_EXECUTOR_SECRET='foo') |
| 263 |
|
def test_invalid_secret(self): |
| 264 |
|
self.assertNotEqual(True, self._run_executor()) |
| 265 |
|
|
| 266 |
|
def test_everything_already_tested(self): |
| 267 |
|
create_validated_submission(self.user, self.validated_assignment) |
| 268 |
|
assert(self._register_executor().pk) |
| 269 |
|
self.assertEqual(False, self._run_executor()) |
| 270 |
|
|
| 271 |
|
def test_parallel_executors_test(self): |
| 272 |
|
NUM_PARALLEL = 3 |
| 273 |
|
self.validated_assignment.test_machines.add(self._register_executor()) |
| 274 |
|
subs = [] |
| 275 |
|
for i in range(1, NUM_PARALLEL + 1): |
| 276 |
|
stud = create_user(get_student_dict(i)) |
| 277 |
|
self.course.participants.add(stud.profile) |
| 278 |
|
self.course.save() |
| 279 |
|
sf = create_submission_file() |
| 280 |
|
subs.append(create_validatable_submission( |