-
Notifications
You must be signed in to change notification settings - Fork 160
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
Make policy names unique in integration tests #4421
Conversation
Otherwise we have name collisions and errors from the Fleet server.
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to just use info.Namespace
for this, but id is unique so it doesn't matter too much.
elastic-agent/pkg/testing/define/define.go
Lines 53 to 57 in a7034ef
// Namespace should be used for isolating data and actions per test. | |
// | |
// This is unique to each test and instance combination so a test that need to | |
// read/write data to a data stream in elasticsearch do not collide. | |
Namespace string |
@@ -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()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth creating a helper for this like UniquePolicyName()
to help people do this properly.
|
Otherwise we have name collisions and errors from the Fleet server. (cherry picked from commit 8e6593f)
Otherwise we have name collisions and errors from the Fleet server.
Related issues