Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Fix content-host export organizations #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ldjebran
Copy link

Command "hammer csv content-hosts" create empty csv file (with headers only) when organization is not in the results returned by API GET organization with full_results=True, seems a limit of 20 records is enforced.

Fix related to bug: https://bugzilla.redhat.com/show_bug.cgi?id=1535565

@ldjebran
Copy link
Author

ldjebran commented Jan 19, 2018

in order to have the unit tests to pass locally I had to add that uri multiple time in cassetes yml file, I am not sure if it's the way to do it , or we should record the requests an other time, but unfortunately I have no access.

dlezz@dlezz:~/projects/hammer-cli-csv$ bundle exec rake test
Debugging not enabled.
Running tests for: setup
Running tests for: resources
WARNING: There is already a VCR request matcher registered for :body_json. Overriding it.
WARNING: There is already a VCR request matcher registered for :params. Overriding it.
Run options: --seed 40158

# Running tests:

........................................................

Finished tests in 25.198509s, 2.2224 tests/s, 8.2545 assertions/s.

56 tests, 208 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to /home/dlezz/projects/coverage. 1762 / 3398 LOC (51.85%) covered.
[Coveralls] Outside the Travis environment, not sending data.

but on CI travis other unittests seems failing, please help encounter this situation

@thomasmckay
Copy link
Member

@ldjebran Tests can be tricky to re-record. Are you able to start forklift devel VM? You can then use this to run the tests against and save the new cassettes.

https://github.com/Katello/hammer-cli-csv#tests

})['results'].each do |organization|
organization_search_options = {:per_page => 999999}
organization_search_options['search'] = "name=\"#{option_organization}\"" if option_organization
@api.resource(:organizations).call(:index, organization_search_options)['results'].each do |organization|
next if option_organization && organization['name'] != option_organization
Copy link
Member

Choose a reason for hiding this comment

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

This line should be removed as it is unnecessary with your change.

@ldjebran ldjebran force-pushed the fix_export_content_hosts branch from e180f38 to 1ee0887 Compare January 22, 2018 13:17
@ldjebran ldjebran force-pushed the fix_export_content_hosts branch from 1ee0887 to 189dcf2 Compare January 23, 2018 09:02
@ldjebran
Copy link
Author

@thomasmckay many thanks for your review, spent many time trying to setup the centos7 devel VM but in vain (The VM always hanging on waiting for IP address), (there is no problem ubuntu VMs eg: for example foreman production VM was installed successfully, but we we need the devel with katello)

dlezz@dlezz:~/projects/hammer-cli-csv$ bundle exec rake
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.5-compliant syntax, but you are running 2.3.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running RuboCop...
Inspecting 69 files
.....................................................................

69 files inspected, no offenses detected
Debugging not enabled.
Running tests for: setup
Running tests for: resources
WARNING: There is already a VCR request matcher registered for :body_json. Overriding it.
WARNING: There is already a VCR request matcher registered for :params. Overriding it.
Run options: --seed 35381

# Running tests:

........................................................

Finished tests in 25.875400s, 2.1642 tests/s, 8.0385 assertions/s.

56 tests, 208 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to /home/dlezz/projects/coverage. 1761 / 3397 LOC (51.84%) covered.
[Coveralls] Outside the Travis environment, not sending data.

cannot figure out why the tests are passing locally and failing on Travis (on other modules that have not updated), if you have the possibility can you please check locally if the same tests are passing for you too.

@beav
Copy link
Contributor

beav commented Jun 15, 2018

This PR seems OK to me, and tests pass now

@thomasmckay can you take a look and merge if appropriate?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants