Skip to content
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

Merged
merged 5 commits into from
Aug 22, 2018
Merged

Move Goexpvar to pytest #2089

merged 5 commits into from
Aug 22, 2018

Conversation

gmmeyer
Copy link
Contributor

@gmmeyer gmmeyer commented Aug 21, 2018

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

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests
  • Git history is clean
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo

Additional Notes

I think this covers everything

Copy link
Contributor

@ofek ofek left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with mock.patch(...)

Copy link
Contributor Author

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

os.path.join(common.HERE, 'compose', 'docker-compose.yaml'),
endpoints=[common.URL]
):
for _ in range(0, 9):
Copy link
Contributor

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


# Default metrics
for gauge in CHECK_GAUGES_DEFAULT:
log.warning(aggregator.metrics(gauge.format(common.CHECK_NAME)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this

[testenv:go_expvar]
deps =
../datadog_checks_base
-r../datadog_checks_base/requirements.in
Copy link
Contributor

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]

Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, sure!

[testenv:unit]
deps =
../datadog_checks_base
-r../datadog_checks_base/requirements.in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too

Copy link
Contributor

@gzussa gzussa left a 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.

[testenv:go_expvar]
deps =
../datadog_checks_base
-r../datadog_checks_base/requirements.in
Copy link
Contributor

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?

@gmmeyer gmmeyer merged commit 53d2526 into master Aug 22, 2018
@gmmeyer gmmeyer deleted the greg/goexpvar branch August 22, 2018 17:40
nmuesch pushed a commit that referenced this pull request Nov 1, 2018
Includes a small change to the check itself to ensure that tags aren't duplicated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants