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

Add RPM Repository tests #39

Merged
merged 1 commit into from
Nov 17, 2015
Merged

Add RPM Repository tests #39

merged 1 commit into from
Nov 17, 2015

Conversation

Ichimonji10
Copy link
Contributor

Add RPM repository tests. Module pulp_smash.tests.rpm.api_v2.test_repo_create
includes the following test cases:

  • CreateTestCase ensures it is possible to create repositories with and
    without feeds.
  • SyncValidFeedTestCase and SyncInvalidFeedTestCase ensure that Pulp
    correctly handles sync requests, regardless of whether the feed is valid.
  • PublishTestCase ensures it is possible to upload an RPM file to a
    repository, copy the repository's contents to a second repository, add a
    distributor to the first repository, publish the first repository, and
    download the original RPM.

Test results:

$ python -m unittest2 pulp_smash.tests.rpm.api_v2.test_sync_publish
.............s........
----------------------------------------------------------------------
Ran 22 tests in 27.118s

OK (skipped=1)

Many thanks to @dkliban for help with designing these tests.

@Ichimonji10
Copy link
Contributor Author

This PR isn't quite ready for a merge yet. But I'd like to get some early review from @dkliban, or anyone else with expertise with RPM repositories. I've reworked the exact form of these tests pretty heavily from when they were first prototyped, and it'd be good to know if I broke anything. Also, the test_error_details test case is failing, and I think there was a bug for that. Can anyone point me to the right bug in our bug tracker?

_delete(cls.cfg, attrs['_href'])


class SyncFeedTestCase(TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

Should this be SyncInvalidFeedTestCase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SyncFeedTestCase and SyncInvalidFeedTestCase have basically identical set-up procedures. I might as well just combine the two classes. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, I'm not sure I really even need any methods from this class except test_status_code. Calling _poll_tasks() implicitly ensures that tasks have been spawned.

Add RPM repository tests. Module `pulp_smash.tests.rpm.api_v2.test_repo_create`
includes the following test cases:

* `CreateTestCase` ensures it is possible to create repositories with and
  without feeds.
* `SyncValidFeedTestCase` and `SyncInvalidFeedTestCase` ensure that Pulp
  correctly handles sync requests, regardless of whether the feed is valid.
* `PublishTestCase` ensures it is possible to upload an RPM file to a
  repository, copy the repository's contents to a second repository, add a
  distributor to the first repository, publish the first repository, and
  download the original RPM.

Test results:

    $ python -m unittest2 pulp_smash.tests.rpm.api_v2.test_sync_publish
    .............s........
    ----------------------------------------------------------------------
    Ran 22 tests in 27.118s

    OK (skipped=1)

Many thanks to @dkliban for help with designing these tests.
@Ichimonji10
Copy link
Contributor Author

This test has been updated and is ready for a full review and merge.

@Ichimonji10 Ichimonji10 changed the title WIP: Add RPM Repository tests Add RPM Repository tests Nov 16, 2015
"""Indicates that polling a task timed out."""


def _poll_tasks(server_config, href):
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to put this in some place that is shared by other tests? We need to poll tasks for other plugins also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. But I'd like to do that in a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Several of the other helper functions can also be extracted from this module too.

@dkliban
Copy link
Member

dkliban commented Nov 17, 2015

I started putting comments on everything that I thought could live outside the test. I think it would be perfectly OK to move those methods in a separate commit.

This looks good to merge.

@Ichimonji10
Copy link
Contributor Author

Thank you @dkliban. See #40.

@Ichimonji10 Ichimonji10 merged commit 04df5c9 into pulp:master Nov 17, 2015
@Ichimonji10 Ichimonji10 deleted the zoo_repo_sync branch November 17, 2015 14:44
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.

None yet

2 participants