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

tests: fix Insights test, increase certain timeouts #66

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

ptoscano
Copy link
Collaborator

Fix the tests, and in particular testSubAndInAndFail, to ensure they work properly in all the cases, and also with newer versions of insights-core:

  • extend the timeouts for certain registration, unregistration, and Insights operations
  • fix mock-insights to properly error out when querying for an unregistered system
  • use a different method to break insights-client according to newer changes in insights-core

See the messages of the various commits for much longer descriptions of the reasons & changes.

ptoscano and others added 3 commits April 17, 2024 16:10
We are getting warnings like these:

   WARNING: Waiting for !ph_in_text("body","User doc is member of more organizations, but no organization was selected") took 7.7 seconds, which is 51% of the timeout.
   WARNING: Waiting for !ph_is_present("footer .pf-m-primary") took 8.7 seconds, which is 58% of the timeout.

Hence extend the timeout for some of the changes related to
registering, unregistering, and Insights status change.

Co-authored-by: Marius Vollmer <[email protected]>
When querying for the details of a system, properly return 404 in case
the system was not registered previously. This makes sure that
insights-client properly reacts to this situation, mimicking what
happens with a real Inventory service.
The sequence of events in the test is the following:
1) register with insights-client, a new machine-id is generated
2) the test moves away the machine-id file
3) a new data upload is triggered by starting the systemd service
4) insights-client eagerly generates a new machine-id file to check
   whether it is registered even if it is not the case (that's another
   issue, much harder to fix)
5) the newly generated machine-id has nothing associated to it
6) a proper warning is shown as expected
7) the original machine-id is restored
8) everything else continues as usual

This worked fine until recent times, as the new machine-id always had
a new UUID. After recent changes in insights-core [1], now the default
machine-id generated by insights-client when the system is registered
with subscription-manager is the subscription-manager UUID. Thus, the
machine-id file generated during step (4) is now always the same, which
then allows insights-client to query for its own details as if nothing
happened.

To break insights-client again, the changes are in the following step
of the above sequence:
4) a new random UUID is written as machine-id file

This new "wrong" machine-id file makes insights-client think that the
status is not correct, and thus the test can keep going as expected.

[1] RedHatInsights/insights-core#4057
@ptoscano ptoscano force-pushed the ptoscano/tests-insights-fixes branch from 0aab1e2 to bbac2c3 Compare April 17, 2024 14:10
Copy link
Contributor

@m-horky m-horky left a comment

Choose a reason for hiding this comment

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

ACK

@m-horky m-horky merged commit ad90b79 into main Apr 17, 2024
7 checks passed
@m-horky m-horky deleted the ptoscano/tests-insights-fixes branch April 17, 2024 14:41
@mvollmer
Copy link
Contributor

Ah,now I get what you were saying about mock-insights not returning a failure! Nice, this is a much faster failure than failing the upload at the end. Thanks!

@ptoscano
Copy link
Collaborator Author

Sadly the new timeouts seem to not help in all the cases; @m-horky, @mvollmer, would you please take a look at #67?

martinpitt added a commit to cockpit-project/bots that referenced this pull request Jun 4, 2024
Fixed in sub-man main branch in
candlepin/subscription-manager-cockpit#66 but
not yet in the stable -1.28 branch.

Known issue #6466
jelly pushed a commit to cockpit-project/bots that referenced this pull request Jun 4, 2024
Fixed in sub-man main branch in
candlepin/subscription-manager-cockpit#66 but
not yet in the stable -1.28 branch.

Known issue #6466
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.

3 participants