Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/elastic/gos…
Browse files Browse the repository at this point in the history
…igar-0.14.3
  • Loading branch information
cmacknz authored Mar 18, 2024
2 parents 0cb4624 + 775e020 commit 3d69369
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions internal/pkg/core/backoff/backoff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type factory func(<-chan struct{}) Backoff

func TestCloseChannel(t *testing.T) {
init := 2 * time.Millisecond
init := time.Second
max := 5 * time.Second

tests := map[string]factory{
Expand All @@ -32,7 +32,7 @@ func TestCloseChannel(t *testing.T) {
c := make(chan struct{})
b := f(c)
close(c)
assert.False(t, b.Wait())
assert.False(t, b.Wait(), "should return false because the channel shuld get closed faster than the next wait duration")
})
}
}
Expand All @@ -59,7 +59,7 @@ func TestUnblockAfterInit(t *testing.T) {

startedAt := time.Now()
assert.True(t, WaitOnError(b, errors.New("bad bad")))
assert.True(t, time.Now().Sub(startedAt) >= init)
assert.True(t, time.Since(startedAt) >= init)
})
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestNextWait(t *testing.T) {

startedAt := time.Now()
b.Wait()
waitDuration := time.Now().Sub(startedAt)
waitDuration := time.Since(startedAt)
nextWait := b.NextWait()

t.Logf("actualWait: %s startWait: %s nextWait: %s", waitDuration, startWait, nextWait)
Expand Down
3 changes: 2 additions & 1 deletion testing/integration/container_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/require"

"github.com/elastic/elastic-agent-libs/kibana"
Expand Down Expand Up @@ -41,7 +42,7 @@ func TestContainerCMD(t *testing.T) {
require.NoError(t, err)

createPolicyReq := kibana.AgentPolicy{
Name: fmt.Sprintf("test-policy-enroll-%d", time.Now().Unix()),
Name: fmt.Sprintf("test-policy-enroll-%s", uuid.New().String()),
Namespace: info.Namespace,
Description: "test policy for agent enrollment",
MonitoringEnabled: []kibana.MonitoringEnabledOption{
Expand Down
3 changes: 2 additions & 1 deletion testing/integration/delay_enroll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/require"

"github.com/elastic/elastic-agent-libs/kibana"
Expand Down Expand Up @@ -44,7 +45,7 @@ func TestDelayEnroll(t *testing.T) {
// name. This policy does not contain any integration.
t.Log("Enrolling agent in Fleet with a test policy")
createPolicyReq := kibana.AgentPolicy{
Name: fmt.Sprintf("test-policy-enroll-%d", time.Now().Unix()),
Name: fmt.Sprintf("test-policy-enroll-%s", uuid.New().String()),
Namespace: info.Namespace,
Description: "test policy for agent enrollment",
MonitoringEnabled: []kibana.MonitoringEnabledOption{
Expand Down
9 changes: 5 additions & 4 deletions testing/integration/logs_ingestion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"context"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"net/http/httputil"
"os"
Expand All @@ -22,6 +21,7 @@ import (
"text/template"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -57,7 +57,7 @@ func TestLogIngestionFleetManaged(t *testing.T) {
// name. This policy does not contain any integration.
t.Log("Enrolling agent in Fleet with a test policy")
createPolicyReq := kibana.AgentPolicy{
Name: fmt.Sprintf("test-policy-enroll-%d", time.Now().Unix()),
Name: fmt.Sprintf("test-policy-enroll-%s", uuid.New().String()),
Namespace: info.Namespace,
Description: "test policy for agent enrollment",
MonitoringEnabled: []kibana.MonitoringEnabledOption{
Expand Down Expand Up @@ -253,8 +253,9 @@ func testFlattenedDatastreamFleetPolicy(
policy kibana.PolicyResponse,
) {
dsType := "logs"
dsNamespace := cleanString(fmt.Sprintf("%snamespace%d", t.Name(), rand.Uint64()))
dsDataset := cleanString(fmt.Sprintf("%s-dataset", t.Name()))
id := uuid.New().String()
dsNamespace := cleanString(fmt.Sprintf("namespace-%s", id))
dsDataset := cleanString(fmt.Sprintf("dataset-%s", id))
numEvents := 60

// tempDir is not deleted to help with debugging issues
Expand Down

0 comments on commit 3d69369

Please sign in to comment.