Skip to content

Add conditional cluster check for datasource-tests#1850

Open
khansaad wants to merge 2 commits intokruize:mvp_demofrom
khansaad:ds-test-update
Open

Add conditional cluster check for datasource-tests#1850
khansaad wants to merge 2 commits intokruize:mvp_demofrom
khansaad:ds-test-update

Conversation

@khansaad
Copy link
Copy Markdown
Contributor

@khansaad khansaad commented Mar 17, 2026

Description

This PR updates the datasource tests to run based on cluster.

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes

How has this been tested?

Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.

  • New Test X
  • Functional testsuite

Test Configuration

  • Kubernetes clusters tested on:

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Include any additional information such as links, test results, screenshots here

Summary by Sourcery

Adjust datasource monitoring tests to run different datasource scenarios based on the detected cluster type (OpenShift vs. non-OpenShift).

Documentation:

  • Update local monitoring test documentation to describe the new cluster-specific datasource scenarios and expectations.

Tests:

  • Split datasource test scenarios into OpenShift-specific (Prometheus + Thanos) and non-OpenShift (Prometheus-only) flows, and select them dynamically at runtime.
  • Extend datasource failure expectation logic to cover single-datasource clusters while preserving existing multi-datasource checks.

Signed-off-by: Saad Khan <saakhan@ibm.com>
@khansaad khansaad added this to the Kruize 0.10.0 Release milestone Mar 17, 2026
@khansaad khansaad requested a review from chandrams March 17, 2026 07:32
@khansaad khansaad self-assigned this Mar 17, 2026
@khansaad khansaad added bug Something isn't working test labels Mar 17, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 17, 2026

Reviewer's Guide

Updates datasource test script and docs to run different datasource scenarios depending on cluster type (OpenShift vs Minikube/Kind), generalizing datasource handling and expected outcomes.

File-Level Changes

Change Details Files
Make datasource test scenarios conditional on cluster type and support single- and dual-datasource configurations.
  • Extend datasource_scenarios map to include generic datasource1/datasource2 combinations for OpenShift and Minikube/Kind clusters
  • Split scenario execution order into openshift_scenario_order and non_openshift_scenario_order arrays
  • Select scenario_order at runtime based on cluster_type and log which datasource configuration is being tested
tests/scripts/local_monitoring_tests/datasource_tests.sh
Generalize datasource variables and validation logic to support clusters with only one effective datasource.
  • Rename PROM/THANOS-specific variables to generic DS1/DS2 in run_datasource_scenario and update_yaml_with_datasources
  • Conditionally log the second datasource only for OpenShift clusters
  • Update the failure-expectation branch to treat both-invalid and invalid scenarios as expected failures with shared messaging
  • Keep YAML keys prometheus-1/thanos-1 but generate unique datasource names per scenario via DS1_NAME/DS2_NAME
tests/scripts/local_monitoring_tests/datasource_tests.sh
Update local monitoring test documentation to describe cluster-specific datasource scenarios and expectations.
  • Document differences between OpenShift (Prometheus + Thanos) and Minikube/Kind (Prometheus only) YAML configurations
  • Rename scenario descriptions from Prometheus/Thanos-specific names to generic valid/invalid variants per cluster type
  • Clarify expected outcomes for each scenario, including success/failure and which datasource is expected to log errors
tests/scripts/local_monitoring_tests/Local_monitoring_tests.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@khansaad khansaad moved this to Under Review in Monitoring Mar 17, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@khansaad
Copy link
Copy Markdown
Contributor Author

@chandrams updated the datasource tests with condtional cluster checks. Attached the test logs for reference

ds-tests-minikube.log
ds-tests-openshift.log

Signed-off-by: Saad Khan <saakhan@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test

Projects

Status: Under Review

Development

Successfully merging this pull request may close these issues.

1 participant