fixes #15916 - infrastructure to switch tests to use vcr #116
fixes #15916 - infrastructure to switch tests to use vcr #116thomasmckay merged 1 commit intoKatello:masterfrom
Conversation
|
Ran w/ |
|
|
Was there an rfc for this? I totally support adding tests, but let's discuss the plan. hammer-cli-katello doesn't use VCR, simply the apipie cache as its input. Could that be an option? Are there already bats tests? I can't seem to find any in https://github.com/Katello/forklift/tree/master/bats. Essentially, I'd like to see some discussion on why we think VCR is the way forward and also how this test suite can be maintainable with an app API that could potentially change. |
|
I'd like to see bats tests as well, yes. This would catch the myriad issues I've had w/ the API changing. For VCR, I'd like tests that confirm that export/import remains consistent, especially since there is going to be some logic added around attaching subscriptions to hosts. Running in live mode is equivalent to the tests I have now. What specifically do you see as potential issues in adding VCR? I'm happy to adjust the strategy. In the end, I want live tests as well as non-live. |
|
I'm not really familiar with VCR nor have any qualms about it; just wondering why we've chosen it. Do we already use it in some other repository? Doing a bit of research on web mocking frameworks, there are many to choose from. It seems like webmock is lighter and more maintainable, according to this blog post from 2015, but it requires a bit more work up front (Yes, it's only one opinion/experience). I do find it strange that a test framework would have such mediocre coverage. I'm playing a bit of devil's advocate if you can't tell. 😈 As we discussed via IRC last week, we should totally pick the easiest way to get tests in hammer-cli-csv first so we get the most bang for the buck, so to speak, and ideally add more fine-grained or maintainable tests over time. If VCR will meet that requirement, so be it. 👍 |
|
@akofink - Definitely bring discussion to my thread on foreman-dev, if desired. VCR is used in our repos; the example I was pointed to as a good example is https://github.com/Katello/runcible |
|
@akofink I'm not sure I would call VCR a web mocking framework. It's more of a tool that allows you to record actual web requests and then we use them as mocks for webmock. We use VCR quite extensively in Katello's repos (katello, runcible, etc) and I haven't heard of any problems. Our requests are complex so being able to record actual requests and use that as mocking data is much easier than manually constructing them in the actual test code. |
|
[test] |
|
@akofink @daviddavis all set for ack/nack |
|
[test] |
README.md
Outdated
There was a problem hiding this comment.
This badge is wrong. It should be [](https://travis-ci.org/Katello/hammer-cli-csv)
There was a problem hiding this comment.
There was a problem hiding this comment.
Oh, I see. I'll change.
|
I believe you need to add a default rake task. It should probably run rubocop, then the tests. |
4aee9fb to
a9d0cc5
Compare
|
APJ thanks @thomasmckay! |
Switching to VCR will allow both running against a live server (as the existing tests do now) or to run in pre-recorded mode. Setting initial code coverage to 26% Added default rake task to run rubocop and test
No description provided.