Closed jotak closed 7 years ago
Note: this error has been seen once on the java agent integration tests (and PR sent there), but not (yet) on the ruby client, though it could happen here also in theory.
@jotak Rubocop is complaining about some code, could you please update it?
oops, forgot to run it locally, sorry... will update
@josejulio the test failures are then same that were mentioned by @pilhuhn yesterday, did you find out what's the cause?
Some tests were pointing directly to subsystem agent, latest version of hawkular services uses the hawkular javaagent. I updated the tests on #218
@jotak could you please rebase?
done
Thanks!
Sorry for not asking until now, but could you put a (unit) test for it?
@josejulio I'm adding a new file for unit tests (there was only integration test on that til now). Also changed rebuild_from_chunks to be a class method.
Awesome thanks!
@josejulio is this good to go?
Hmm, still some work to do here...
@jotak perhaps it doesn't have to be a class method, but only normal instance method htat is private?
I made it a class method because it has no dependency on the object's state, it looks cleaner to me but also easier to test with unit tests (the issue, if I have to instanciate the client in the unit test, is that the initializer performs http call to get the version... which sucks for a unit test)
Private class methods cannot be called from an instanciated object of that class, such as in java?
I see, I tried to make it instance private (https://pastebin.com/61bFZMG2) and the old tests passed, but you are right that initializing the client does the call.
Edit: perhaps it would worth adding some option in the hash that is passed to the client constructor that would omit the version check. But this is not related to your PR at all, I don't want to block it, on the other hand exposing internal method is no good either, because we would need to maintain them and preserve their backward-compatibility, even though they are only impl. detail
That's probably a common case for java-ist doing ruby :) http://stackoverflow.com/questions/20674/is-there-a-way-to-call-a-private-class-method-from-an-instance-in-ruby
Well, if no objection, I'd rather go for making it public.
I'd rather go for making it public.
:+1: go ahead, I can take that in a follow up PR by adding option to the client that will not do the http check.
Ok. But intuitively I would say it's a good practice to turn stateless methods into class methods, no? It's a way to formalize that they don't rely on the object state.
Metrics reading could occur while writing chunks is not finished (ie. some chunks are written but not all), which would produce errors. We can detect that and return nil instead.