Skip to content
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

[6.3] Restore activation key and content hosts subscriptions (BZ:1296978) #5374

Merged
merged 1 commit into from Nov 22, 2017

Conversation

ldjebran
Copy link
Contributor

cover: https://bugzilla.redhat.com/show_bug.cgi?id=1296978

(sat-6.3.0) dlezz@elysion:~/projects/robottelo-fork$ pytest -v tests/foreman/cli/test_subscription.py::SubscriptionTestCase::test_positive_restore_ak_and_content_hosts_subscriptions
================================================= test session starts ==================================================
platform linux2 -- Python 2.7.13, pytest-3.1.3, py-1.4.34, pluggy-0.4.0 -- /home/dlezz/.pyenv/versions/sat-6.3.0/bin/python2.7
cachedir: .cache
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.20.0, services-1.2.1, mock-1.6.2, forked-0.2, cov-2.5.1
collected 1 item 
2017-10-17 10:51:47 - conftest - DEBUG - Deselect of WONTFIX BZs is disabled in settings


tests/foreman/cli/test_subscription.py::SubscriptionTestCase::test_positive_restore_ak_and_content_hosts_subscriptions PASSED

============================================== 1 passed in 656.55 seconds ==============================================

@ldjebran ldjebran added 6.3 CLI Issues and PRs involving the CLI QETestCoverage Issues and PRs relating to a Satellite bug labels Oct 17, 2017
@ldjebran ldjebran self-assigned this Oct 17, 2017
@codecov
Copy link

codecov bot commented Oct 17, 2017

Codecov Report

Merging #5374 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5374   +/-   ##
=======================================
  Coverage   61.32%   61.32%           
=======================================
  Files          33       33           
  Lines        3669     3669           
=======================================
  Hits         2250     2250           
  Misses       1419     1419

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c4625d...568786e. Read the comment docs.

Copy link
Contributor

@renzon renzon left a comment

Choose a reason for hiding this comment

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

ACK

:id: a44fdeda-9c8c-4316-85b4-a9b6b9f1ffdb

:steps:
1. Setup activation key , lifecycle environment and content view
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did you get these steps? I read BZ information and it has some deviations from your steps

Copy link
Contributor

Choose a reason for hiding this comment

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

Especially that csv was edited to another host/capsules before applying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oshtaier to make the exact BZ steps we have to be able to get an other manifest with the same subscriptions but with different agreement number, that is not realizable with the current infra implementation (we need muti-manifests s to be supported), the current coverage implement that by deleting completely the manifest and re-import all data, if you insist on the exact implementation we have to make this PR in do not merge state (marked as blocked ) and wait that PR implementation (multi-manifest) to be merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Coverage that you provided in that PR is also needed, but still I am not sure that it is actually cover mentioned BZ

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to @oshtaier . The steps are looking different to me especially without changing subscription id in csv.
We need @JacobCallahan approval whether these steps fully cover the BZ, and if not - corresponding framework expansion is needed.

Copy link
Member

Choose a reason for hiding this comment

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

@abalakh @ldjebran There is one primary case that should be covered in the BZ, which the current test does not cover. The ideal steps for the bug would be:

  1. Import a manifest, with a couple of subscriptions.
  2. Register at least one host (preferably more).
  3. Attach the same subscription to all registered hosts.
  4. Export the content hosts to a csv file.
  5. Modify the csv file to change the hosts from their current subscription to a different one.
  6. Import the csv file
    Result: The hosts should no longer have the old subscription, and now have the new one.

There is also an additional test case that could be written for what I did in comment 36. This is pretty similar to the steps above, but does not require hosts to be registered.

  1. Upload a manifest with a couple of subscriptions.
  2. Create an activation key, aligning one of the subscriptions to it.
  3. Export the activation key to a csv file.
  4. Modify the csv file to change the activation key's subscriptions from the previous sub to a different one.
  5. Import the csv file.
    Result: The activation key should not have the old subscription, and should have the new one.

With that said, this is still a very valid test that we should have in the code, just not aligned to this bug.

:id: a44fdeda-9c8c-4316-85b4-a9b6b9f1ffdb

:steps:
1. Setup activation key , lifecycle environment and content view
Copy link
Member

Choose a reason for hiding this comment

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

@abalakh @ldjebran There is one primary case that should be covered in the BZ, which the current test does not cover. The ideal steps for the bug would be:

  1. Import a manifest, with a couple of subscriptions.
  2. Register at least one host (preferably more).
  3. Attach the same subscription to all registered hosts.
  4. Export the content hosts to a csv file.
  5. Modify the csv file to change the hosts from their current subscription to a different one.
  6. Import the csv file
    Result: The hosts should no longer have the old subscription, and now have the new one.

There is also an additional test case that could be written for what I did in comment 36. This is pretty similar to the steps above, but does not require hosts to be registered.

  1. Upload a manifest with a couple of subscriptions.
  2. Create an activation key, aligning one of the subscriptions to it.
  3. Export the activation key to a csv file.
  4. Modify the csv file to change the activation key's subscriptions from the previous sub to a different one.
  5. Import the csv file.
    Result: The activation key should not have the old subscription, and should have the new one.

With that said, this is still a very valid test that we should have in the code, just not aligned to this bug.

@ldjebran
Copy link
Contributor Author

PUT dot merge to make the changes

@ldjebran
Copy link
Contributor Author

@abalakh @JacobCallahan @oshtaier comments addressed

(sat-6.3.0) dlezz@elysion:~/projects/robottelo-fork$ pytest tests/foreman/cli/test_subscription.py -v -k "_restore_"
=================================================================================================== test session starts ====================================================================================================
platform linux2 -- Python 2.7.13, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- /home/dlezz/.pyenv/versions/2.7.13/envs/sat-6.3.0/bin/python
cachedir: .cache
rootdir: /home/dlezz/projects/robottelo-fork, inifile:
plugins: xdist-1.20.1, services-1.2.1, mock-1.6.3, forked-0.2, cov-2.5.1, fauxfactory-1.0.1
collected 9 items                                                                                                                                                                                                           
2017-11-21 10:27:16 - conftest - DEBUG - BZ deselect is disabled in settings


tests/foreman/cli/test_subscription.py::SubscriptionTestCase::test_positive_restore_ak_and_content_hosts_subscriptions PASSED
tests/foreman/cli/test_subscription.py::SubscriptionTestCase::test_positive_restore_ak_with_modified_subscription PASSED
tests/foreman/cli/test_subscription.py::SubscriptionTestCase::test_positive_restore_content_hosts_with_modified_subscription PASSED

==================================================================================================== 6 tests deselected ====================================================================================================
============================================================

@ldjebran ldjebran force-pushed the 6.3.0_qe_test_coverage_1296978 branch from 41b1d9a to 568786e Compare November 21, 2017 08:51
@ldjebran ldjebran changed the title [6.3] Restore activation key and content hosts subscriptions [6.3] Restore activation key and content hosts subscriptions (BZ:1296978) Nov 21, 2017
@ldjebran
Copy link
Contributor Author

@renzon have added two more tests to this PR please revisit

@renzon
Copy link
Contributor

renzon commented Nov 21, 2017

ACK

Copy link
Member

@JacobCallahan JacobCallahan left a comment

Choose a reason for hiding this comment

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

ACK. These changes will be a fantastic addition to our automation!

Copy link
Contributor

@oshtaier oshtaier left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@abalakh abalakh left a comment

Choose a reason for hiding this comment

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

ACK

self.assertEqual(len(csv_data), 2)
for row_data in csv_data:
# The subscription is saved in the following format:
# """<quantity>|<sku>|<name>|<contract>|<account>"""
Copy link
Contributor

Choose a reason for hiding this comment

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

bonus karma for such comments, they're very helpful for understanding the code 👍

@abalakh abalakh merged commit 70de63c into SatelliteQE:master Nov 22, 2017
@ldjebran ldjebran deleted the 6.3.0_qe_test_coverage_1296978 branch January 23, 2018 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Issues and PRs involving the CLI QETestCoverage Issues and PRs relating to a Satellite bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants