Skip to content

Commit

Permalink
Increase timeout for mimir.rules.kubernetes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ptodev committed Oct 2, 2024
1 parent 5c773d2 commit f07b45a
Showing 1 changed file with 7 additions and 5 deletions.
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

0 comments on commit f07b45a

Please sign in to comment.