Skip to content
Snippets Groups Projects
Select Git revision
  • 9082ec303105aea4da7b97dce04ca4582218edfa
  • master default protected
  • replication_test
  • release-1.10 protected
  • dev protected
  • 556-usage-statistics
  • 553-semantic-recommendation-2
  • 553-semantic-recommendation
  • release-1.9 protected
  • 551-init-broker-service-permissions
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • v1.10.4 protected
  • v1.10.3 protected
  • v1.10.2 protected
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
41 results

omconstants.py

Blame
  • conftest.py 1.27 KiB
    import logging
    import os
    
    import pytest
    
    from clients.grafana_client import GrafanaClient
    from tests.grafana import GrafanaContainer
    
    
    @pytest.fixture(scope="session", autouse=True)
    def session(request):
        """
        Create one Grafana container per test run only (admin:admin)
        :param request: /
        :return: The Grafana container
        """
        logging.debug("[fixture] creating grafana container")
        container = GrafanaContainer()
        logging.debug("[fixture] starting grafana container")
        container.start()
        os.environ['DASHBOARD_UI_ENDPOINT'] = container.get_url()
        os.environ['SYSTEM_USERNAME'] = 'admin'
        os.environ['SYSTEM_PASSWORD'] = 'admin'
    
        # destructor
        def stop_grafana():
            container.stop()
    
        request.addfinalizer(stop_grafana)
        return container
    
    
    @pytest.fixture(scope="function", autouse=True)
    def cleanup(request, session):
        """
        Clean up after each test by removing dashboards (=so it's empty again)
        :param request: /
        :param session: /
        :return:
        """
        logging.info("[fixture] clean dashboards")
        grafana = GrafanaClient().connect()
        for dashboard in grafana.search.search_dashboards():
            grafana.dashboard.delete_dashboard(dashboard['uid'])
            logging.debug(f"[fixture] deleted dashboard {dashboard['uid']}")