Exemplo n.º 1
0
def test_empty_trace(tmp_path):
    path = tmp_path / "empty_trace.txt"
    with open(path, "w") as f:
        f.write("")
    sched = Scheduler(path,
                      config_path,
                      debug=True,
                      db_path="postgresql://*****:*****@localhost/sentinel")
    sched.start()
Exemplo n.º 2
0
def test_run(monkeypatch):
    def mock_time(obj):
        return 1e8

    def mock_sleep(obj, delay):
        return

    monkeypatch.setattr(Scheduler, "scheduler_time", mock_time)
    monkeypatch.setattr(Scheduler, "scheduler_sleep", mock_sleep)
    sched = Scheduler(trace_path,
                      config_path,
                      debug=True,
                      db_path="postgresql://*****:*****@localhost/sentinel")
    sched.start()
Exemplo n.º 3
0
def test_load_config():
    sched = Scheduler(
        trace_path,
        config_path,
        debug=True,
        db_path="postgresql://*****:*****@192.168.0.110/sentinel")
    assert sched._cfg.addr == "test_addr"
    assert sched._cfg.username == "test_user"
    assert sched._cfg.password == "test_password"
    assert sched._cfg.name == "test_name"
    assert sched._cfg.port == 12345
    assert sched._cfg.log_path == "test.log"
    assert sched._cfg.overwrite_log is True
    assert sched._cfg.cafile == "test_ca.pem"
    assert sched._cfg.certfile == "test_cert.crt"
    assert sched._cfg.keyfile == "test_key.key"
Exemplo n.º 4
0
from scheduler.main_scheduler import Scheduler

scheduler = Scheduler("./all_devices_trace_2m.txt",
                      "./all_devices_config_2m.json")
scheduler.start()
Exemplo n.º 5
0
from scheduler.main_scheduler import Scheduler

scheduler = Scheduler("./debug_trace.txt", "./debug_config.json")
scheduler.start()
Exemplo n.º 6
0
from scheduler.main_scheduler import Scheduler

scheduler = Scheduler("./simple_light_trace.txt", "./simple_light_config.json")
scheduler.start()
Exemplo n.º 7
0
from scheduler.main_scheduler import Scheduler

scheduler = Scheduler("./no_hvac_trace.txt", "./no_hvac_config.json")
scheduler.start()
Exemplo n.º 8
0
from scheduler.main_scheduler import Scheduler

scheduler = Scheduler("./no_sensor_trace.txt", "./no_sensor_config.json")
scheduler.start()