Exemple #1
0
    def check_config(self, client, server_config, host, my_headers={}):
        uri_prefix = server_config.rest_uri
        host = "http://" + host
        uri = urljoin(host, uri_prefix)
        prefix = get_index_prefix(server_config)
        expected_results = {
            "identification": f"Pbench server {server_config.COMMIT_ID}",
            "indices": {
                "run_index": f"{prefix}.v6.run-data.",
                "run_toc_index": f"{prefix}.v6.run-toc.",
                "result_index": f"{prefix}.v5.result-data-sample.",
                "result_data_index": f"{prefix}.v5.result-data.",
            },
            "api": {
                "results": f"{host}/results",
                "elasticsearch": f"{uri}/elasticsearch",
                "endpoints": f"{uri}/endpoints",
                "graphql": f"{uri}/graphql",
                "controllers_list": f"{uri}/controllers/list",
                "controllers_months": f"{uri}/controllers/months",
                "datasets_list": f"{uri}/datasets/list",
                "datasets_detail": f"{uri}/datasets/detail",
                "register": f"{uri}/register",
                "login": f"{uri}/login",
                "logout": f"{uri}/logout",
                "user": f"{uri}/user/",
                "host_info": f"{uri}/host_info",
                "upload_ctrl": f"{uri}/upload/ctrl/",
            },
        }

        response = client.get(f"{server_config.rest_uri}/endpoints",
                              headers=my_headers)
        res_json = response.json
        assert res_json == expected_results
Exemple #2
0
    def __init__(self, config: PbenchServerConfig, logger: Logger):
        """
        __init__ Initialize the resource with info each call will need.

        Args:
            :config: The Pbench server config object
            :logger: a logger
        """
        self.logger = logger
        self.es_url = get_es_url(config)
        self.prefix = get_index_prefix(config)
Exemple #3
0
    def build_index(self, server_config, dates):
        """
        build_index Build the index list for query

        Args:
            dates (iterable): list of date strings
        """
        prefix = get_index_prefix(server_config)
        idx = prefix + ".v6.run-data."
        index = "/"
        for d in dates:
            index += f"{idx}{d},"
        return index
Exemple #4
0
    def __init__(self, config: PbenchServerConfig, logger: Logger):
        """
        __init__ Construct the API resource

        Args:
            :config: server config values
            :logger: message logging

        Report the server configuration to a web client. By default, the Pbench
        server ansible script sets up a local Apache reverse proxy routing
        through the HTTP port (80); an external reverse-proxy can be configured
        without the knowledge of the server, and this API will use reverse-proxy
        Forwarded or X-Forwarded-Host HTTP headers to discover the proxy
        configuration. All server endpoints will be reported with respect to that
        address.
        """
        self.logger = logger
        self.host = config.get("pbench-server", "host")
        self.uri_prefix = config.rest_uri
        self.prefix = get_index_prefix(config)
        self.commit_id = config.COMMIT_ID
 def __init__(self, config, logger):
     self.logger = logger
     self.es_url = get_es_url(config)
     self.prefix = get_index_prefix(config)