|
8 | 8 | package providers |
9 | 9 |
|
10 | 10 | import ( |
| 11 | + "fmt" |
11 | 12 | "os" |
12 | 13 | "strings" |
13 | 14 | "testing" |
14 | 15 |
|
15 | 16 | "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" |
| 17 | + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/providers/names" |
16 | 18 | "github.com/DataDog/datadog-agent/comp/core/autodiscovery/providers/types" |
17 | 19 | workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" |
18 | 20 | "github.com/stretchr/testify/assert" |
@@ -64,7 +66,7 @@ func TestProcessLogProviderEvents(t *testing.T) { |
64 | 66 | assert.Len(t, changes.Unschedule, 0) |
65 | 67 | config := changes.Schedule[0] |
66 | 68 | assert.Equal(t, "process-test-service-gen-_var_log_test.log", config.Name) |
67 | | - assert.Equal(t, "process_log", config.Provider) |
| 69 | + assert.Equal(t, names.ProcessLog, config.Provider) |
68 | 70 | assert.Contains(t, string(config.LogsConfig), "/var/log/test.log") |
69 | 71 |
|
70 | 72 | // check that scheduling the same config again doesn't do anything |
@@ -188,7 +190,7 @@ func TestProcessLogProviderString(t *testing.T) { |
188 | 190 | p, ok := provider.(*ProcessLogConfigProvider) |
189 | 191 | require.True(t, ok) |
190 | 192 |
|
191 | | - assert.Equal(t, "process_log", p.String()) |
| 193 | + assert.Equal(t, names.ProcessLog, p.String()) |
192 | 194 | } |
193 | 195 |
|
194 | 196 | func TestStream(t *testing.T) { |
@@ -339,7 +341,7 @@ func TestReferenceCounting(t *testing.T) { |
339 | 341 | assert.Len(t, changes.Unschedule, 0) |
340 | 342 | config := changes.Schedule[0] |
341 | 343 | assert.Equal(t, "process-test-service-gen-_var_log_test.log", config.Name) |
342 | | - assert.Equal(t, "process_log://test-service-gen:_var_log_test.log", config.ServiceID) |
| 344 | + assert.Equal(t, fmt.Sprintf("%s://test-service-gen:_var_log_test.log", names.ProcessLog), config.ServiceID) |
343 | 345 |
|
344 | 346 | // Verify reference count is 1 |
345 | 347 | serviceLogKey := p.generateServiceLogKey("test-service-gen", "/var/log/test.log") |
@@ -530,7 +532,7 @@ func TestReferenceCountingPathSanitization(t *testing.T) { |
530 | 532 |
|
531 | 533 | config := changes.Schedule[0] |
532 | 534 | assert.Equal(t, "process-test-service-gen-_var_log_test.log", config.Name) |
533 | | - assert.Equal(t, "process_log://test-service-gen:_var_log_test.log", config.ServiceID) |
| 535 | + assert.Equal(t, fmt.Sprintf("%s://test-service-gen:_var_log_test.log", names.ProcessLog), config.ServiceID) |
534 | 536 | } |
535 | 537 |
|
536 | 538 | func TestInvalidEvent(t *testing.T) { |
|
0 commit comments