Skip to content

Add testing fixture for Assuan client and server #13

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Mar 21, 2025

This fixture starts a createrepo-agent server in a thread and connects a client to that server so that tests can be implemented to validate operations performed by the client.

cottsay added 2 commits March 21, 2025 15:19
This fixture starts a createrepo-agent server in a thread and connects a
client to that server so that tests can be implemented to validate
operations performed by the client.
@cottsay cottsay added the enhancement New feature or request label Mar 21, 2025
@cottsay cottsay requested a review from nuclearsandwich March 21, 2025 20:21
@cottsay cottsay self-assigned this Mar 21, 2025
Comment on lines +21 to +25
TEST_P(smoke, commit) {
gpg_error_t rc = assuan_transact(client, "COMMIT", NULL, NULL, NULL, NULL, NULL, NULL);
EXPECT_FALSE(rc);
}
INSTANTIATE_TEST_SUITE_P( , smoke, testing::Values("empty", "populated"), smoke::PrintParamName);
Copy link
Member Author

@cottsay cottsay Mar 21, 2025

Choose a reason for hiding this comment

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

This is a pretty bare example of how the fixture can be used.

In the test body, you have a running CRA server (in another thread) and an already connected client context. The fixture directory has already been copied to a temporary directory, so you can modify it as part of the test or test setup. The client and server will be terminated gracefully during the test tear-down.

Note that even though the CRA server has been started, it hasn't actually loaded any repository metadata, so you can absolutely modify it in the test body to set up the test as long as you haven't invoked any operations that would load the metadata first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant