Skip to content

Conversation

jkremser
Copy link
Member

This is basically the same PR as the #49 but now targeting directly the master branch (not the 0.3.0 integration branch)

VCR_UPDATE=1 will now re-record the templates against the currently running Hawkular instance. By template I mean the recorded communication in yaml with <%= foobar => in it. This works for both VCR (done manually here https://git.io/vV5PM) and WebSocketVCR (it's a feature that is turned on by reverse_substitution: true)

VCR_OFF=1 is still working and can be used for running the tests against the live Hawkular instance, w/o recording it

Point of the whole PR is not to over write the VCR tapes over and over again, because the feed_id is randomly generated, or for those UUIDs in tests.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 94.352% when pulling f120d4b on Jiri-Kremser:erb-templating into 0edf190 on hawkular:master.

@pilhuhn
Copy link
Member

pilhuhn commented Apr 28, 2016

LGTM - @abonas can you please have a look as well?

@abonas
Copy link
Contributor

abonas commented Apr 28, 2016

I will review this on Sunday

CHANGES.rdoc Outdated
This document describes the relevant changes between releases of the
_hawkular-client_ project.

=== V 0.3.0 (not released yet)
Copy link
Contributor

Choose a reason for hiding this comment

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

this section looks irrelevant for this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's easier to keep the track of the changes this way, but if we want to be super correct, it hasn't been released yet, so it should not be in the CHANGES.rdoc.

If you are asking about the 'All the clients have been unified into one', that is a left over from previous work and isn't logically related to this PR.

It's gone.

@abonas
Copy link
Contributor

abonas commented May 1, 2016

I was trying to review this, but this PR is very big and also not separated to commits that might explain the changes separately. I left couple of comments, but I am definitely having difficulties understanding the code and the intention here. It might needs to be broken into smaller pieces. Or explain better in description what exactly is being done here.

@jkremser
Copy link
Member Author

jkremser commented May 1, 2016

Sorry for that, the PR isn't actually so big, most of the code is the VCR cassette templates. We can have a call if you want and I can describe the changes.

The main intention here is not to have PRs like this in the future ;) It's quite annoying to overwrite the VCR cassettes in the git repo. On the other hand, having the stale data isn't good too. Heiko started to using the ERB templating in the VCR. This way, you can 'parametrize' some data (this feature https://relishapp.com/vcr/vcr/v/3-0-1/docs/cassettes/dynamic-erb-cassettes).

This partially works. Issue with the dynamic cassettes is that there is no easy to keep them up to date with the real implementation. That's why I raised this PR, it still uses the ERB dynamic cassettes when running with no special evn vars, but at the same time, if running as VCR_UPDATE=1 rspec, it updates all the templates. The way I do that is different for VCR and for WebSocketVCR.

For WebSocketVCR it's a built in feature in the gem, that can be turned on by reverse_substitution option. As for the normal VCR, I have to do it manually here: https://github.com/hawkular/hawkular-client-ruby/pull/56/files#diff-93830fa29d616f7c87903d08b5b1b29aR107

Side note1: in Hawkular the feed id (basically the ID of the agent that collect the data from WildFly server) is a random UUID, so if you run the rspec against a live server, it'll be different all the time. Hence, the need for some parametrization of the data.

@abonas
Copy link
Contributor

abonas commented May 1, 2016

why is "Removing the 'not yet released' changes in CHANGES.rdoc" a separate commit?

@abonas
Copy link
Contributor

abonas commented May 1, 2016

Sorry for that, the PR isn't actually so big, most of the code is the VCR cassette templates. We can have a call if you want and I can describe the changes.

The main intention here is not to have PRs like this in the future ;) It's quite annoying to overwrite the VCR cassettes in the git repo. On the other hand, having the stale data isn't good too. Heiko started to using the ERB templating in the VCR. This way, you can 'parametrize' some data (this feature https://relishapp.com/vcr/vcr/v/3-0-1/docs/cassettes/dynamic-erb-cassettes).

This partially works. Issue with the dynamic cassettes is that there is no easy to keep them up to date with the real implementation. That's why I raised this PR, it still uses the ERB dynamic cassettes when running with no special evn vars, but at the same time, if running as VCR_UPDATE=1 rspec, it updates all the templates. The way I do that is different for VCR and for WebSocketVCR.

For WebSocketVCR it's a built in feature in the gem, that can be turned on by reverse_substitution option. As for the normal VCR, I have to do it manually here: https://github.com/hawkular/hawkular-client-ruby/pull/56/files#diff-93830fa29d616f7c87903d08b5b1b29aR107

reverse_substitution - is the name coming from somewhere built in? it is not very clear/how it relates to templates.

Side note1: in Hawkular the feed id (basically the ID of the agent that collect the data from WildFly server) is a random UUID, so if you run the rspec against a live server, it'll be different all the time. Hence, the need for some parametrization of the data.

yes, the feature itself and its benefits are quite clear :)

@coveralls
Copy link

coveralls commented May 3, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.352% when pulling dbe612b on Jiri-Kremser:erb-templating into 0edf190 on hawkular:master.

@jkremser
Copy link
Member Author

jkremser commented May 3, 2016

reverse_substitution - is the name coming from somewhere built in? it is not very clear/how it relates to templates.

It's an option for the WebSocketVCR, if it's used, it basically records/creates the templates. I.e. such cassettes that have variables on places where the values should be. Normal substitution goes the other way around, hence the name reverse substitution.

https://git.io/vw9RY
https://git.io/vw9RQ

@jkremser
Copy link
Member Author

jkremser commented May 3, 2016

why is "Removing the 'not yet released' changes in CHANGES.rdoc" a separate commit?

Right, it doesn't make sense to introduce the change and then remove it withing the 1 PR, agreed. Can we just use the squash&merge thing on GitHub at the end? It's less work. (https://github.com/blog/2141-squash-your-commits)

@abonas
Copy link
Contributor

abonas commented May 3, 2016

Right, it doesn't make sense to introduce the change and then remove it withing the 1 PR, agreed. Can we just use the squash&merge thing on GitHub at the end? It's less work. (https://github.com/blog/2141-squash-your-commits)

I never used it this way, I'd typically squash or git amend manually. does it make sense to do it for a change that shouldn't have entered in the first place?

jkremser added 2 commits May 3, 2016 12:05
…ecord the templates against the currently running Hawkular instance.
… not compatible with us, so let's use the 1.2.x
@coveralls
Copy link

coveralls commented May 3, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.352% when pulling 6788789 on Jiri-Kremser:erb-templating into 0edf190 on hawkular:master.

@jkremser
Copy link
Member Author

jkremser commented May 3, 2016

does it make sense to do it for a change that shouldn't have entered in the first place?

Well, if you squash together

+foo

and

-foo

there will be no foo in the resulting commit. But I've already done that, because I did also the s/e/example/

@coveralls
Copy link

coveralls commented May 3, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.352% when pulling 6788789 on Jiri-Kremser:erb-templating into 0edf190 on hawkular:master.

@abonas
Copy link
Contributor

abonas commented May 3, 2016

ok looking good :)

@jkremser
Copy link
Member Author

jkremser commented May 3, 2016

@pilhuhn could you please merge? If you rebase your pr on this, it'll fix the travis failures

@pilhuhn pilhuhn merged commit 6aa5967 into hawkular:master May 3, 2016
@jkremser jkremser deleted the erb-templating branch May 12, 2016 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants