Skip to content

Refactor tests to use workflow generators#372

Merged
gerrod3 merged 1 commit into
pulp:masterfrom
gerrod3:tests_utils_refactor
May 27, 2021
Merged

Refactor tests to use workflow generators#372
gerrod3 merged 1 commit into
pulp:masterfrom
gerrod3:tests_utils_refactor

Conversation

@gerrod3

@gerrod3 gerrod3 commented May 17, 2021

Copy link
Copy Markdown
Contributor

[noissue]

@gerrod3
gerrod3 force-pushed the tests_utils_refactor branch 3 times, most recently from 28d82d8 to 77fd293 Compare May 17, 2021 16:09
@gerrod3 gerrod3 mentioned this pull request May 18, 2021
6 tasks
@dralley

dralley commented May 19, 2021

Copy link
Copy Markdown
Contributor

@gerrod3 Sorry I didn't get a chance to look deeply at this before going on PTO, I'll make sure to do so when I get back on Monday

@gerrod3 gerrod3 mentioned this pull request May 19, 2021
WorkflowStep as WS,
repo_api,
pub_api,
distro_api,

@dralley dralley May 24, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

edit: Hold off on making any changes yet, let's get #375 merged first and we can look at these changes later. We will need to put the compatibility release for pulpcore 3.13 out shortly and probably shouldn't wait on this PR.

going to stop my review here for now

These feel a bit over-shortened, and I think since most other plugins use publication_api, distribution_api and so forth, we should probably continue the pattern. An outside developer should be able to look at the code and understand what's going on without knowing the shorthands.

@gerrod3

gerrod3 commented May 26, 2021

Copy link
Copy Markdown
Contributor Author

@dralley What do you think of doing something like what pulp_ansible does? https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/tests/functional/utils.py#L142-L158

@dralley

dralley commented May 26, 2021

Copy link
Copy Markdown
Contributor

+1. The migration plugin does something like that also.

@gerrod3
gerrod3 force-pushed the tests_utils_refactor branch 6 times, most recently from fea328a to 5fa8224 Compare May 27, 2021 14:49
def test_01_sync(self):
"""Assert that syncing the repository triggers auto-publish and auto-distribution."""
self.assertEqual(self.publications_api.list().count, 0)
self.assertEqual(self.pub_api.list().count, 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do think we should stick to publications_api. Partly for consistency with other plugins, and partly because unnecessary shorthands make it harder for the uninitiated to understand what's going on. e.g. it would be great if external contributors could read our tests and understand / contribute to them easily.

Comment thread pulp_python/tests/functional/utils.py Outdated
cls.content_api = content_api


class SyncHelpersMixin:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would go with TestHelpersMixin since it has helpers for more than just sync

@dralley

dralley commented May 27, 2021

Copy link
Copy Markdown
Contributor

I like this approach a lot more than the DSL approach from previously, and it looks like it removes more code as well. Thanks!

See comments, otherwise I think this looks fine.

@gerrod3
gerrod3 force-pushed the tests_utils_refactor branch 2 times, most recently from 67b9639 to 74b6390 Compare May 27, 2021 17:53
@gerrod3
gerrod3 force-pushed the tests_utils_refactor branch from 74b6390 to 0d1a437 Compare May 27, 2021 17:56
@gerrod3
gerrod3 merged commit 7c7b096 into pulp:master May 27, 2021
@gerrod3
gerrod3 deleted the tests_utils_refactor branch May 27, 2021 18:07
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.

2 participants