Skip to content

Commit

Permalink
MON-3934: Parallelize some readonly/non disruptive e2e tests for fast…
Browse files Browse the repository at this point in the history
…er runs
  • Loading branch information
machine424 committed Jul 10, 2024
1 parent 5341b80 commit ed679ce
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/e2e/alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ func TestAlertmanagerDataReplication(t *testing.T) {

// The Alertmanager API should be protected by authentication/authorization.
func TestAlertmanagerAPI(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
err := framework.Poll(5*time.Second, 5*time.Minute, func() error {
body, err := f.AlertmanagerClient.GetAlertmanagerAlerts(
"filter", `alertname="Watchdog"`,
Expand Down Expand Up @@ -748,6 +750,8 @@ func TestAlertmanagerDisabling(t *testing.T) {
}

func TestAlertManagerHasAdditionalAlertRelabelConfigs(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
const (
expectPlatformLabel = "openshift_io_alert_source"
expectPlatformLabelValue = "platform"
Expand Down
1 change: 1 addition & 0 deletions test/e2e/image_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
v1 "k8s.io/api/core/v1"
)


func TestImageRegistryPods(t *testing.T) {
var pods *v1.PodList

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/kube_state_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
)

func TestKSMMetricsSuppression(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()

suppressedPattern, _ := regexp.Compile("kube_.*_annotations")

Expand Down Expand Up @@ -74,6 +76,8 @@ func TestKSMMetricsSuppression(t *testing.T) {
}

func TestKSMCRSMetrics(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
const timeout = 5 * time.Minute
assetsDir := "./assets"
ksmCRSMetricPrefix := "kube_customresource"
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ func testTargetsUp(t *testing.T) {
// Once we have the need to test multiple recording rules, we can unite them in
// a single test function.
func TestMemoryUsageRecordingRule(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
f.ThanosQuerierClient.WaitForQueryReturnGreaterEqualOne(
t,
time.Minute,
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/metrics_adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ func isAPIServiceAvailable(conditions []apiservicesv1.APIServiceCondition) bool
}

func TestMetricsAPIAvailability(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
ctx := context.Background()
var lastErr error
err := wait.Poll(time.Second, 5*time.Minute, func() (bool, error) {
Expand Down Expand Up @@ -106,6 +108,8 @@ func TestMetricsAPIAvailability(t *testing.T) {
}

func TestNodeMetricsPresence(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
ctx := context.Background()
var lastErr error
err := wait.Poll(time.Second, 5*time.Minute, func() (bool, error) {
Expand Down Expand Up @@ -144,6 +148,8 @@ func TestNodeMetricsPresence(t *testing.T) {
}

func TestPodMetricsPresence(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
var lastErr error
ctx := context.Background()
err := wait.Poll(time.Second, 5*time.Minute, func() (bool, error) {
Expand Down Expand Up @@ -185,6 +191,8 @@ func TestPodMetricsPresence(t *testing.T) {
}

func TestAggregatedMetricPermissions(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
ctx := context.Background()
present := func(where []string, what string) bool {
sort.Strings(where)
Expand Down Expand Up @@ -340,6 +348,8 @@ func TestPrometheusAdapterCARotation(t *testing.T) {
}

func TestMetricsServerRollout(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
skipMetricsServerTests(t)
for _, test := range []scenario{
{
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/multi_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ import (
)

func TestMultinamespacePrometheusRule(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
ctx := context.Background()
nsName := "openshift-test-prometheus-rules" + strconv.FormatInt(time.Now().Unix(), 36)
t.Parallel()

t.Cleanup(func() {
f.OperatorClient.DeleteIfExists(ctx, nsName)
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/priority_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
// system-cluster-critical 2000000000 false 114m
// system-node-critical 2000001000 false 114m
func TestToEnsureUserPriorityClassIsPresentAndLower(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
ctx := context.Background()

// Get system priority class values.
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
)

func TestPrometheusMetrics(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
expected := map[string]int{
"prometheus-operator": 1,
"prometheus-k8s": 2,
Expand Down Expand Up @@ -69,6 +71,8 @@ func TestPrometheusMetrics(t *testing.T) {
// consider whether the new default value is still suitable.
// Refer to this link for some points that may need to be examined https://github.com/openshift/prometheus/pull/206#issuecomment-2182168575.
func TestPrometheusGOGC(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
gogc := 75
f.ThanosQuerierClient.WaitForQueryReturn(
t, 5*time.Minute, `min(go_gc_gogc_percent{namespace="openshift-monitoring", service="prometheus-k8s", container="kube-rbac-proxy"})`, // kube-rbac-proxy exposes prometheus container's metrics.
Expand All @@ -83,6 +87,8 @@ func TestPrometheusGOGC(t *testing.T) {
}

func TestAntiAffinity(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
for _, tc := range []struct {
name string
instance string
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/security_headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
)

func TestAlertmanagerPolicyHeaders(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
// The tenancy port (9092) is only exposed in-cluster, so we need to use
// port forwarding to access kube-rbac-proxy.
host, cleanUp, err := f.ForwardPort(t, f.Ns, "alertmanager-main", 9092)
Expand All @@ -36,6 +38,8 @@ func TestAlertmanagerPolicyHeaders(t *testing.T) {
}

func TestPrometheusPolicyHeaders(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
host, cleanUp, err := f.ForwardPort(t, f.Ns, "prometheus-k8s", 9091)
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/telemeter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func TestTelemeterRemoteWrite(t *testing.T) {

// TestTelemeterClient verifies that the telemeter client can collect metrics from the monitoring stack and forward them to the telemeter server.
func TestTelemeterClient(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
{
f.PrometheusK8sClient.WaitForQueryReturn(
t,
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/thanos_querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
)

func TestThanosQueryCanQueryWatchdogAlert(t *testing.T) {
// The test is "read-only", safe to run in parallel with others.
t.Parallel()
// The 2-minute timeout is what console CI tests set.
// If this test is flaky, we should increase until
// we can fix the possible DNS resolve issues.
Expand All @@ -43,6 +45,8 @@ const (
)

func TestMonitoringApiRoles(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()

cf, err := f.CreateNamespace(testNamespaceTQ)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/validatingwebhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ spec:
)

func TestPrometheusRuleValidatingWebhook(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
ctx := context.Background()

_, err := f.AdmissionClient.ValidatingWebhookConfigurations().Get(ctx, prometheusRuleWebhookName, metav1.GetOptions{})
Expand Down Expand Up @@ -134,6 +136,8 @@ func TestPrometheusRuleValidatingWebhook(t *testing.T) {
}

func TestAlertManagerConfigValidatingWebhook(t *testing.T) {
// The test shouldn't be disruptive, safe to run in parallel with others.
t.Parallel()
ctx := context.Background()

_, err := f.AdmissionClient.ValidatingWebhookConfigurations().Get(ctx, alertmanagerConfigWebhookName, metav1.GetOptions{})
Expand Down

0 comments on commit ed679ce

Please sign in to comment.