コード例 #1
0
ファイル: test_paths.py プロジェクト: a-s-995/checkmk-1
def test_paths_in_omd_and_opt_root(monkeypatch):

    omd_root = '/omd/sites/dingeling'
    with monkeypatch.context() as m:
        m.setitem(os.environ, 'OMD_ROOT', omd_root)
        test_paths = import_module("%s/cmk/utils/paths.py" % repo_path())
        _check_paths(omd_root, test_paths)
コード例 #2
0
ファイル: test_store.py プロジェクト: tboerger/checkmk
def fixture_test_thread_1(locked_file):
    # HACK: We abuse modules as data containers, so we have to do this Kung Fu...
    t_store = import_module("cmk/utils/store.py")

    t = LockTestThread(t_store, locked_file)
    t.start()

    yield t

    t.store.release_all_locks()
    t.terminate()
コード例 #3
0
ファイル: test_store.py プロジェクト: mc1980/checkmk
def test_locking(tmp_path, path_type):
    # HACK: We abuse modules as data containers, so we have to do this Kung Fu...
    store1 = store
    store2 = import_module("cmk/utils/store.py")

    assert store1 != store2

    locked_file_path = tmp_path.joinpath("locked_file")
    with locked_file_path.open(mode="w", encoding="utf-8") as locked_file:
        locked_file.write(u"")
        path = "%s" % locked_file_path

        t1 = LockTestThread(store1, path)
        t1.start()
        t2 = LockTestThread(store2, path)
        t2.start()

        # Take lock with store1
        t1.do = "lock"
        while range(20):
            if store1.have_lock(path):
                break
            time.sleep(0.01)
        assert store1.have_lock(path) is True

        # Now try to get lock with store2
        t2.do = "lock"
        time.sleep(0.2)
        assert store1.have_lock(path) is True
        assert store2.have_lock(path) is False

        # And now unlock store1 and check whether store2 has the lock now
        t1.do = "unlock"
        while range(20):
            if not store1.have_lock(path):
                break
            time.sleep(0.01)
        assert store1.have_lock(path) is False
        time.sleep(0.2)
        assert store2.have_lock(path) is True

        # Not 100% safe, but protects agains left over ressources in the good case at least
        store1.release_all_locks()
        store2.release_all_locks()
        t1.terminate()
        t1.join()
        t2.terminate()
        t2.join()
コード例 #4
0
def mk_logwatch():
    return import_module("agents/plugins/mk_logwatch")
コード例 #5
0
def mk_filestats():
    return import_module("agents/plugins/mk_filestats.py")
コード例 #6
0
def check_uniserv():
    return import_module("active_checks/check_uniserv")
コード例 #7
0
def mk_jolokia():
    return import_module("agents/plugins/mk_jolokia.py")
コード例 #8
0
def mk_docker():
    return import_module("agents/plugins/mk_docker.py")
コード例 #9
0
def check_mail():
    return import_module("active_checks/check_mail")
コード例 #10
0
def check_mail_loop():
    return import_module("active_checks/check_mail_loop")
コード例 #11
0
def check_traceroute():
    return import_module("active_checks/check_traceroute")
コード例 #12
0
def apache_status():
    return import_module("agents/plugins/apache_status")
コード例 #13
0
def check_form_submit():
    return import_module("active_checks/check_form_submit")
コード例 #14
0
def mk_mongodb():
    return import_module("agents/plugins/mk_mongodb")