-
Notifications
You must be signed in to change notification settings - Fork 152
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
refactor grafanaNet route cfg + unit testing for setting up route + configurable retry backoff intervals + more #465
Conversation
because the schemas need to be delivered timely
f835dec
to
751b484
Compare
What I have seen so far (I have reviewed commits till 751b484) looks good to me. |
The table package should not reach out into configuration packages such as cfg and imperatives Instead the table is something that should be setup _from_ imperatives (this was already the case) and _from_ the config So, we move out the config bits from table and make it work with the generic interface. Just as we already tested table setup from imperatives, this will let us test the same through cfg as well. (see next commit) While we're at it: * move imperative's table Interface and MockTable to the table package, so it can be used in various places * cleaner "TableConfig" type * move validation of badMetrics settings and its creation to table config and construction (that was the only case from the moved config stuff that accessed the table directly and couldn't be interface-ized) One interesting thing is that the cfg imports imperatives. Why? simply because your toml configuration may contain imperative commands that need to be executed
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.
ALRIGHT:
- thank god for tests
- everything seems to check out
for anyone lurking...
i figured it out how to do it. pretty happy now to have unit testing both from the toml config, as well as imperatives side |
@fkaleo i got a bit of a surprise for you..
I thought it was a good idea to refactor that ugly-and-getting-longer constructor function for GrafanaNet routes to use a cfg struct. added some options, so far so good.
thought it may also make sense to add some testing to make sure that 1) given an init command or 2) given a toml config, the proper grafananet route is created. but both of those affect the table directly, so you have to inspect the table (or use a mock that makes it a bit easier). for use case 1 it was fairly straightforward, but 2 landed me in a bit of a mess (circular dependency) . I'll have a fresh look at it on monday. i still like the idea of unit testing, but need to figure out if it can be done realistically
well at least even without the tests, this PR does clean stuff up, both in code and docs.