-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Goexpvar to pytest #2089
Move Goexpvar to pytest #2089
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -108,7 +110,11 @@ def _load(self, instance): | |||
url = parsed_url._replace(path=GO_EXPVAR_URL_PATH).geturl() | |||
|
|||
tags = instance.get('tags', []) | |||
tags.append("expvar_url:%s" % url) | |||
self.log.warning(tags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove
go_expvar/tests/conftest.py
Outdated
with open(filepath, 'r') as f: | ||
data = f.read() | ||
json_data = json.loads(data) | ||
p = mock.patch('datadog_checks.go_expvar.GoExpvar._get_data', return_value=json_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with mock.patch(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the format I've used here is used all over the project, but I'll change it
go_expvar/tests/conftest.py
Outdated
os.path.join(common.HERE, 'compose', 'docker-compose.yaml'), | ||
endpoints=[common.URL] | ||
): | ||
for _ in range(0, 9): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for _ in range(9):
is fine
go_expvar/tests/test_unit.py
Outdated
|
||
# Default metrics | ||
for gauge in CHECK_GAUGES_DEFAULT: | ||
log.warning(aggregator.metrics(gauge.format(common.CHECK_NAME))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this
go_expvar/tox.ini
Outdated
[testenv:go_expvar] | ||
deps = | ||
../datadog_checks_base | ||
-r../datadog_checks_base/requirements.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
../datadog_checks_base[deps]
and put deps
under [testenv]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use -e
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works, sure!
go_expvar/tox.ini
Outdated
[testenv:unit] | ||
deps = | ||
../datadog_checks_base | ||
-r../datadog_checks_base/requirements.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. 👍 regarding @ofek feedbacks.
go_expvar/tox.ini
Outdated
[testenv:go_expvar] | ||
deps = | ||
../datadog_checks_base | ||
-r../datadog_checks_base/requirements.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use -e
too?
Includes a small change to the check itself to ensure that tags aren't duplicated
What does this PR do?
GoExpvar was still on the old testing framework, this moves it to pytest and tox.
There was some weird duplication of tags. I now ensure that we only add the url tag if it's not in the config.
Review checklist
no-changelog
label attachedAdditional Notes
I think this covers everything