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

Some updates to brokers & testutils packages #26

Merged
merged 7 commits into from
Sep 4, 2023

Conversation

denisonbarbosa
Copy link
Member

@denisonbarbosa denisonbarbosa commented Sep 4, 2023

When writing the PAM service tests, some changes had to be made to improve consistency and naming across the board. Also, since we intended to run a single broker for the PAM tests, we also had to update the mock creation to stop relying on testing.T.

This PR is mainly an extraction of the changes in the brokers that were made in #22.

We used to have a single layout validator for the broker, but this would
create race issues when dealing with multiple calls at the same time, so
this commit changes it to be one validator per sessionID.
This was preventing us from being able to run a general broker for the
tests. Also updates newBrokerForTests function with the mock
changes.
@denisonbarbosa denisonbarbosa requested a review from a team as a code owner September 4, 2023 09:52
@denisonbarbosa
Copy link
Member Author

@didrocks, I think the tests we were thinking about (having multiple brokers and checking if the right one is answering the calls) make more sense in the PAM tests, as we operate directly on the broker object in the broker tests... (And in the manager tests they kind of already work, because [technically] the manager always has at least two brokers).

@didrocks
Copy link
Member

didrocks commented Sep 4, 2023

@didrocks, I think the tests we were thinking about (having multiple brokers and checking if the right one is answering the calls) make more sense in the PAM tests, as we operate directly on the broker object in the broker tests... (And in the manager tests they kind of already work, because [technically] the manager always has at least two brokers).

I disagree, I think they should be in the broker tests because you want to proove that the brokers package is safe when used against multiple brokers.

Then, nothing prevent in the PAM tests or rather integration tests, to exercise multiple brokers too.

Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

Excellent! Feel free to add the 2 other tests in a separate PR.

There is only one small thing to align between the 3 tests, see my comments, then, we should be good to merge that one.

In order to be a bit more consistent with the PAM module, we changed
some namings from "value" to "entry".

Also updated the calls to newBrokerForTests in the tests, since the
function signature got changed.
Now the sessionID can have some values appended to it in order to allow
us to use a single broker during parallel tests without having the same
sessionID to deal with.
This test had some unused variables and its behaviour was a bit strange
to understand. This commit reworks it to be more straightforward and
also print the golden files even in error cases.
@denisonbarbosa denisonbarbosa merged commit 70cb005 into main Sep 4, 2023
@denisonbarbosa denisonbarbosa deleted the update-broker-pkg branch September 4, 2023 12:57
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