integration/

directory
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0

README

Integration Tests

Basic integration test suite for cluster-health-analyzer running on OpenShift.

Usage

# Deploy and test
make deploy-integration
make test-integration

# Cleanup
make undeploy-integration

Requirements

  • OpenShift cluster access (oc login required)
  • Go 1.26+
  • Permissions to create resources in openshift-monitoring namespace
  • PrometheusRule CRD available (standard OpenShift installation)

Test Prerequisites

Before running tests, ensure Thanos querier is accessible:

# Start port-forward to Thanos (required for Prometheus client)
make proxy

This runs oc port-forward -n openshift-monitoring svc/thanos-querier 9090:9091 in the background and is required for tests to query cluster metrics.

Test Lifecycle

Integration tests follow a specific resource lifecycle pattern:

  1. Resource Creation: Each test creates resources with unique names (timestamp-based suffix)
  2. No Automatic Cleanup: Resources are intentionally left running after tests for inspection
  3. Pre-Test Cleanup: Each test's BeforeEach removes its own resources from previous runs
  4. Manual Cleanup: Remove all test resources with:
    oc delete deployment,prometheusrule -l test-type=crashloop -n openshift-monitoring
    oc delete deployment,prometheusrule -l test-type=stress -n openshift-monitoring
    

This approach allows you to inspect resources after test completion while preventing accumulation across test runs.

Configuration

Override defaults via environment variables:

CHA_IMAGE=quay.io/myorg/cluster-health-analyzer:dev make deploy-integration
CHA_IMAGE=quay.io/myorg/cluster-health-analyzer:dev make test-integration

Directories

Path Synopsis
Package framework provides utilities for integration testing.
Package framework provides utilities for integration testing.
Package simulate provides utilities for running stress tests via the simulate command.
Package simulate provides utilities for running stress tests via the simulate command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL