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

Increase timeout for mimir.rules.kubernetes tests #1806

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions internal/component/mimir/rules/kubernetes/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
mimirClient "github.com/grafana/alloy/internal/mimir/client"
)

var updateTimeout = 6 * time.Second

type fakeMimirClient struct {
rulesMut sync.RWMutex
rules map[string][]rulefmt.RuleGroup
Expand Down Expand Up @@ -151,7 +153,7 @@ func TestEventLoop(t *testing.T) {
rules, err := processor.mimirClient.ListRules(ctx, "")
require.NoError(t, err)
return len(rules) == 1
}, time.Second, 10*time.Millisecond)
}, updateTimeout, 10*time.Millisecond)

// Update the rule in kubernetes
rule.Spec.Groups[0].Rules = append(rule.Spec.Groups[0].Rules, v1.Rule{
Expand All @@ -167,7 +169,7 @@ func TestEventLoop(t *testing.T) {
require.NoError(t, err)
rules := allRules[mimirNamespaceForRuleCRD("alloy", rule)][0].Rules
return len(rules) == 2
}, time.Second, 10*time.Millisecond)
}, updateTimeout, 10*time.Millisecond)

// Remove the rule from kubernetes
require.NoError(t, ruleIndexer.Delete(rule))
Expand All @@ -178,7 +180,7 @@ func TestEventLoop(t *testing.T) {
rules, err := processor.mimirClient.ListRules(ctx, "")
require.NoError(t, err)
return len(rules) == 0
}, time.Second, 10*time.Millisecond)
}, updateTimeout, 10*time.Millisecond)
}

func TestAdditionalLabels(t *testing.T) {
Expand Down Expand Up @@ -258,7 +260,7 @@ func TestAdditionalLabels(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(rules))
return len(rules) == 1
}, 3*time.Second, 10*time.Millisecond)
}, updateTimeout, 10*time.Millisecond)

// The map of rules has only one element.
for ruleName, rule := range rules {
Expand Down Expand Up @@ -366,7 +368,7 @@ func TestExtraQueryMatchers(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(rules))
return len(rules) == 1
}, 3*time.Second, 10*time.Millisecond)
}, updateTimeout, 10*time.Millisecond)

// The map of rules has only one element.
for ruleName, rule := range rules {
Expand Down