Exemple #1
0
def test_syslog_ng_paths_client_relay_server(fake_testcase_parameters):
    syslog_ng_paths_server = SyslogNgPaths(
        fake_testcase_parameters, ).set_syslog_ng_paths(instance_name="server")
    syslog_ng_paths_relay = SyslogNgPaths(
        fake_testcase_parameters, ).set_syslog_ng_paths(instance_name="relay")
    syslog_ng_paths_client = SyslogNgPaths(
        fake_testcase_parameters, ).set_syslog_ng_paths(instance_name="client")

    assert syslog_ng_paths_client.get_instance_name() == "client"
    assert syslog_ng_paths_relay.get_instance_name() == "relay"
    assert syslog_ng_paths_server.get_instance_name() == "server"
Exemple #2
0
def test_syslog_ng_paths(fake_testcase_parameters):
    syslog_ng_paths = SyslogNgPaths(fake_testcase_parameters)
    syslog_ng_paths.set_syslog_ng_paths(instance_name="server")
    assert set(list(syslog_ng_paths._SyslogNgPaths__syslog_ng_paths)) == {
        "dirs", "file_paths", "binary_file_paths"
    }
    assert set(list(
        syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["dirs"])) == {
            "install_dir"
        }
    assert set(
        list(syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["file_paths"])
    ) == {
        "config_path",
        "persist_path",
        "pid_path",
        "control_socket_path",
        "stderr",
        "stdout",
    }
    assert set(
        list(syslog_ng_paths.
             _SyslogNgPaths__syslog_ng_paths["binary_file_paths"])) == {
                 "syslog_ng_binary",
                 "syslog_ng_ctl",
                 "loggen",
                 "slogkey",
                 "slogverify",
             }
def test_syslog_ng_paths(tc_unittest):
    syslog_ng_paths = SyslogNgPaths(tc_unittest.testcase_context,
                                    tc_unittest.get_fake_testcase_parameters())
    syslog_ng_paths.set_syslog_ng_paths(instance_name="server")
    assert set(list(syslog_ng_paths._SyslogNgPaths__syslog_ng_paths)) == {
        "dirs", "file_paths", "binary_file_paths"
    }
    assert set(list(
        syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["dirs"])) == {
            "working_dir", "install_dir"
        }
    assert set(
        list(syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["file_paths"])
    ) == {
        "config_path",
        "persist_path",
        "pid_path",
        "control_socket_path",
        "stderr",
        "stdout",
    }
    assert set(
        list(syslog_ng_paths.
             _SyslogNgPaths__syslog_ng_paths["binary_file_paths"])) == {
                 "syslog_ng_binary",
                 "syslog_ng_ctl",
             }
def test_instance_already_configured(tc_unittest):
    syslog_ng_paths_server = SyslogNgPaths(
        tc_unittest.testcase_context,
        tc_unittest.get_fake_testcase_parameters()).set_syslog_ng_paths(
            instance_name="server")
    with pytest.raises(Exception):
        syslog_ng_paths_server.set_syslog_ng_paths(instance_name="client")
def test_syslog_ng_paths_client_relay_server(tc_unittest):
    syslog_ng_paths_server = SyslogNgPaths(
        tc_unittest.testcase_context,
        tc_unittest.get_fake_testcase_parameters()).set_syslog_ng_paths(
            instance_name="server")
    syslog_ng_paths_relay = SyslogNgPaths(
        tc_unittest.testcase_context,
        tc_unittest.get_fake_testcase_parameters()).set_syslog_ng_paths(
            instance_name="relay")
    syslog_ng_paths_client = SyslogNgPaths(
        tc_unittest.testcase_context,
        tc_unittest.get_fake_testcase_parameters()).set_syslog_ng_paths(
            instance_name="client")

    assert syslog_ng_paths_client.get_instance_name() == "client"
    assert syslog_ng_paths_relay.get_instance_name() == "relay"
    assert syslog_ng_paths_server.get_instance_name() == "server"
Exemple #6
0
 def new_syslog_ng(self, instance_name="server"):
     instance_paths = SyslogNgPaths(
         self.__testcase_context,
         self.__testcase_parameters).set_syslog_ng_paths(instance_name)
     syslog_ng = SyslogNg(self.__logger_factory, instance_paths,
                          self.__testcase_parameters)
     self.__teardown_actions.append(syslog_ng.stop)
     return syslog_ng
Exemple #7
0
def test_syslog_ng_paths_parent_class_of_paths(fake_testcase_parameters):
    syslog_ng_paths = SyslogNgPaths(fake_testcase_parameters)
    syslog_ng_paths.set_syslog_ng_paths(instance_name="server")
    for __key, value in syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["file_paths"].items():
        assert isinstance(value, PosixPath) is True

    for __key, value in syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["dirs"].items():
        assert isinstance(value, PosixPath) is True

    for __key, value in syslog_ng_paths._SyslogNgPaths__syslog_ng_paths["binary_file_paths"].items():
        assert isinstance(value, PosixPath) is True
Exemple #8
0
    def __init__(self, testcase_parameters):
        self.instance_paths = SyslogNgPaths(
            testcase_parameters).set_syslog_ng_paths("server")
        self.master_key = None
        self.derived_key = None
        self.decryption_key = None
        self.slogkey = self.instance_paths.get_slogkey_bin()
        self.slogverify = self.instance_paths.get_slogverify_bin()

        self.create_master_key()
        self.create_derived_key()
        self.create_decryption_key()
Exemple #9
0
 def __register_instance(self, instance_name):
     instance_paths = SyslogNgPaths(
         self.__testcase_context,
         self.__testcase_parameters).set_syslog_ng_paths(instance_name)
     syslog_ng_cli = SyslogNgCli(self.__logger_factory, instance_paths,
                                 self.__testcase_parameters)
     syslog_ng = SyslogNg(syslog_ng_cli)
     self.__teardown_actions.append(syslog_ng.stop)
     self.__instances.update({instance_name: {}})
     self.__instances[instance_name]["syslog-ng"] = syslog_ng
     self.__instances[instance_name]["config"] = SyslogNgConfig(
         self.__logger_factory, instance_paths, syslog_ng.get_version())
Exemple #10
0
def syslog_ng(request, testcase_parameters):
    instance_paths = SyslogNgPaths(testcase_parameters).set_syslog_ng_paths(
        "server")
    syslog_ng = SyslogNg(instance_paths, testcase_parameters)
    request.addfinalizer(lambda: syslog_ng.stop())
    return syslog_ng
Exemple #11
0
def syslog_ng(request, testcase_parameters):
    tc_parameters.INSTANCE_PATH = SyslogNgPaths(testcase_parameters).set_syslog_ng_paths("server")
    syslog_ng = SyslogNg(tc_parameters.INSTANCE_PATH, testcase_parameters)
    request.addfinalizer(lambda: syslog_ng.stop())
    return syslog_ng
Exemple #12
0
def test_instance_already_configured(fake_testcase_parameters):
    syslog_ng_paths_server = SyslogNgPaths(
        fake_testcase_parameters, ).set_syslog_ng_paths(instance_name="server")
    with pytest.raises(Exception):
        syslog_ng_paths_server.set_syslog_ng_paths(instance_name="client")