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

Fix functionality (audit, loglevel) tests to actually wait for changes #233

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

jkyros
Copy link
Contributor

@jkyros jkyros commented Jun 22, 2024

This functionality test has been failing since we did our last bump.

It was honestly never really testing anything because it never waited for the deployments, we were mostly getting lucky and not checking errors. See this run for an example of the old "tests nothing and succeeds" behavior: https://github.com/kedacore/keda-olm-operator/actions/runs/8209089746/job/22472571935

This change is basically:

  • add a testCase annotation to the deployment containing the test case name when we attempt an attribute change
  • wait for that annotation to show up after we apply our kedacontroller, signifying that the controller processed the deployment
  • then we can check for the attribute we changed and make sure it handled it properly for our specific testcase

I'm not in love with this fix, but I think it should be dependable until we can make some deliberate decisions/refactors.

NOTE: The audit config tests don't work right either, but I only wiggled them a little bit, because they are harder to solve because the functionality they are testing is currently broken, i.e. you can't currently deconfigure audit, so you can't ever reset the operator to a "clean" state to try the next test case. (That has to do with how we calculate our manifestival changes from the previous manifest and not the base manifest, and how we only transform if our values are non-empty [1] [2] ). We can and probably should fix that later.

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO)

Fixes #

@jkyros jkyros requested a review from zroubalik as a code owner June 22, 2024 01:16
Previously the functionality tests that tested the log level changes
were not waiting for rollouts to happen, so they were effectively not
testing that the logLevel and audit flags were properly set on the
deployment.

Recent releases have changed that timing so these tests have started to
fail.

This changes the test such that they now wait for controller to process
each of the changes (or not process each of the changes, depending on
the test case). It does this by adding an additional deployment
annotation for each test case, so the test case knows that the
controller has processed the test case and it can check the values.

This probably needs a more complete refactor at some point, but this at
least makes the test dependable.

The audit config tests don't work perfectly either, but that is harder
to solve because the functionality they are testing is currently kind of
broken, i.e. you can't currently deconfigure audit, so you can't ever
reset the test to a "clean" state to try the next test case. For now I
made them work by having them sequentially add the args without resetting.

Signed-off-by: John Kyros <[email protected]>
@jkyros jkyros force-pushed the make-loglevel-test-work branch from 68acfb6 to c926be8 Compare June 22, 2024 01:36
@jkyros jkyros changed the title Fix loglevel functionality test so it actually waits for changes Fix loglevel functionality tests to actually wait for changes Jun 22, 2024
@jkyros jkyros changed the title Fix loglevel functionality tests to actually wait for changes Fix functionality (audit, loglevel) tests to actually wait for changes Jun 22, 2024
@joelsmith
Copy link
Contributor

/lgtm
Thanks for fixing it!

@joelsmith joelsmith merged commit 4967f87 into kedacore:main Jun 25, 2024
6 checks passed
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