Esempio n. 1
0
    def test_initiate_apm_client_with_url_present(self, monkeypatch):
        monkeypatch.setitem(Utility.environment["elasticsearch"], 'enable',
                            True)
        monkeypatch.setitem(Utility.environment["elasticsearch"],
                            'service_name', "kairon")
        monkeypatch.setitem(Utility.environment["elasticsearch"],
                            'apm_server_url', "http://localhost:8082")

        client = Utility.initiate_apm_client_config()
        assert client == {
            "SERVER_URL": "http://localhost:8082",
            "SERVICE_NAME": "kairon",
            'ENVIRONMENT': "development"
        }

        monkeypatch.setitem(Utility.environment["elasticsearch"],
                            'secret_token', "12345")

        client = Utility.initiate_apm_client_config()
        assert client == {
            "SERVER_URL": "http://localhost:8082",
            "SERVICE_NAME": "kairon",
            'ENVIRONMENT': "development",
            "SECRET_TOKEN": "12345"
        }
Esempio n. 2
0
    def test_initiate_apm_client_env_not_present(self, monkeypatch):
        monkeypatch.setitem(Utility.environment["elasticsearch"], 'enable',
                            True)
        monkeypatch.setitem(Utility.environment["elasticsearch"], 'env_type',
                            None)

        assert Utility.initiate_apm_client_config() is None
Esempio n. 3
0
    def test_initiate_apm_client_service_url_not_present(self, monkeypatch):
        monkeypatch.setitem(Utility.environment["elasticsearch"], 'enable',
                            True)
        monkeypatch.setitem(Utility.environment["elasticsearch"],
                            'apm_server_url', None)
        monkeypatch.setitem(Utility.environment["elasticsearch"],
                            'service_name', None)

        assert not Utility.initiate_apm_client_config()
Esempio n. 4
0
 def test_initiate_apm_client_enabled(self, monkeypatch):
     monkeypatch.setitem(Utility.environment["elasticsearch"], 'enable',
                         True)
     assert not Utility.initiate_apm_client_config()
Esempio n. 5
0
 def test_initiate_apm_client_disabled(self):
     assert not Utility.initiate_apm_client_config()