Skip to content

Commit

Permalink
Add retry logic to fluent test
Browse files Browse the repository at this point in the history
  • Loading branch information
lisguo committed Dec 3, 2024
1 parent 2f1b7a7 commit 834411d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/fluent/fluent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/aws/amazon-cloudwatch-agent-test/util/awsservice"
)

const logStreamRetry = 20
const logStreamRetry = 10

// fluent log group with expected log message fields
var logGroupToKey = map[string][][]string{
Expand Down Expand Up @@ -61,10 +61,19 @@ func TestFluentLogs(t *testing.T) {
logGroupToKey = logGroupToKeyWindows
}

currRetries := 0
now := time.Now()
for group, fieldsArr := range logGroupToKey {
group = fmt.Sprintf("/aws/containerinsights/%s/%s", env.EKSClusterName, group)
if !awsservice.IsLogGroupExists(group) {
for currRetries < logStreamRetry {
if awsservice.IsLogGroupExists(group) {
break
} else {
currRetries++
time.Sleep(time.Duration(currRetries) * time.Second)
}
}
if currRetries >= logStreamRetry {
t.Fatalf("fluent log group doesn't exsit: %s", group)
}

Expand Down

0 comments on commit 834411d

Please sign in to comment.