-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
|
||
import pytest | ||
|
||
from datadog_checks.gitlab_runner import GitlabRunnerCheck | ||
|
||
from .common import ALLOWED_METRICS, CONFIG, CUSTOM_TAGS, GITLAB_RUNNER_TAGS | ||
|
||
|
||
def assert_check(aggregator): | ||
""" | ||
Basic Test for gitlab integration. | ||
""" | ||
aggregator.assert_service_check( | ||
GitlabRunnerCheck.MASTER_SERVICE_CHECK_NAME, | ||
status=GitlabRunnerCheck.OK, | ||
tags=GITLAB_RUNNER_TAGS + CUSTOM_TAGS, | ||
count=2, | ||
) | ||
aggregator.assert_service_check( | ||
GitlabRunnerCheck.PROMETHEUS_SERVICE_CHECK_NAME, status=GitlabRunnerCheck.OK, tags=CUSTOM_TAGS, count=2 | ||
) | ||
for metric in ALLOWED_METRICS: | ||
if metric.startswith('ci_runner'): | ||
aggregator.assert_metric("gitlab_runner.{}".format(metric)) | ||
else: | ||
aggregator.assert_metric("gitlab_runner.{}".format(metric), tags=CUSTOM_TAGS, count=2) | ||
|
||
|
||
@pytest.mark.usefixtures("dd_environment") | ||
def test_check(aggregator): | ||
gitlab_runner = GitlabRunnerCheck('gitlab_runner', CONFIG['init_config'], {}, instances=CONFIG['instances']) | ||
|
||
gitlab_runner.check(CONFIG['instances'][0]) | ||
gitlab_runner.check(CONFIG['instances'][0]) | ||
|
||
assert_check(aggregator) | ||
|
||
|
||
@pytest.mark.e2e | ||
def test_e2e(dd_agent_check): | ||
aggregator = dd_agent_check(CONFIG, rate=True) | ||
|
||
assert_check(aggregator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters