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

[flakiness] kubernetes_secrets provider unit tests #7057

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Feb 27, 2025

What does this PR do?

This PR introduces the following fixes and improvements:

  • Loosens Time Constraints in Unit Tests (needed for certain type of CI runners):

    • The TTLDelete value in test configurations was increased from 2s to 10s, ensuring tests have more leeway in processing cache expiration.
    • The waitForSignal value was adjusted from 1s to 2s to reduce test flakiness.
  • Adds Debug Logging for Fetch When Cache is Disabled: relevant comment

    • When the cache is disabled, fetching secrets from the API now logs the retrieved secret’s resource version for better visibility into API interactions.
  • Fixes a Typo in a Unit Test Name: relevant comment

    • The test case "key in secret not found" was incorrectly named and is now corrected to "key in secret found".

Why is it important?

Fixes a test failure (Test_Run/secret_no-update_and_no-signal) that caused CI flakiness

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have made corresponding changes to the default configuration files.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added an entry in ./changelog/fragments using the changelog tool.
  • I have added an integration test or an E2E test.

Disruptive User Impact

No expected impact on users. These changes are limited to debugging logs and test improvements.

How to test this PR locally

mage test:unit

Related issues

Copy link
Contributor

mergify bot commented Feb 27, 2025

This pull request does not have a backport label. Could you fix it @pkoutsovasilis? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-ci backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch skip-changelog and removed skip-ci labels Feb 27, 2025
@pkoutsovasilis
Copy link
Contributor Author

buildkite test this

@pkoutsovasilis pkoutsovasilis force-pushed the fix/kubernetes_unit_tests_flakiness branch from 017b6f2 to d63b1a3 Compare February 27, 2025 20:03
@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 27, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @pkoutsovasilis

@pkoutsovasilis
Copy link
Contributor Author

created a new issue to capture a new Flaky test here. The other failures are already reported thus I will retry

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review February 27, 2025 22:18
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner February 27, 2025 22:18
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link

@adamkasztenny adamkasztenny left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pkoutsovasilis pkoutsovasilis added the flaky-test Unstable or unreliable test cases. label Feb 27, 2025
@pkoutsovasilis pkoutsovasilis merged commit 02fae02 into elastic:main Mar 4, 2025
15 checks passed
@pkoutsovasilis pkoutsovasilis deleted the fix/kubernetes_unit_tests_flakiness branch March 4, 2025 09:05
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)

# Conflicts:
#	internal/pkg/composable/providers/kubernetessecrets/kubernetes_secrets.go
#	internal/pkg/composable/providers/kubernetessecrets/kubernetes_secrets_test.go
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)
pkoutsovasilis added a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Mar 4, 2025
* fix: loosen up redundant time constraints in unit-test

* fix: correct unit-test name

* fix: add debug logs for Fetch when cache is disabled

(cherry picked from commit 02fae02)

# Conflicts:
#	internal/pkg/composable/providers/kubernetessecrets/kubernetes_secrets.go
#	internal/pkg/composable/providers/kubernetessecrets/kubernetes_secrets_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch flaky-test Unstable or unreliable test cases. skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants