forked from mtusi2026/mtusi2026lab5
17 lines
434 B
Python
17 lines
434 B
Python
import os
|
|
import time
|
|
|
|
|
|
def inject(repository, job, point):
|
|
action = repository.fault(job, point)
|
|
if action == "crash":
|
|
os._exit(71)
|
|
if action == "pause":
|
|
time.sleep(12)
|
|
if action == "timeout":
|
|
time.sleep(repository.settings.timeout + 5)
|
|
if action == "transient":
|
|
raise TimeoutError("injected_transient")
|
|
if action == "permanent":
|
|
raise ValueError("injected_permanent")
|