-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix up windows tests for static converter by breaking them out from l…
…inux specific tests (#6822) Signed-off-by: Erik Baranowski <[email protected]>
- Loading branch information
1 parent
b2403fc
commit 644fa14
Showing
13 changed files
with
231 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
internal/converter/internal/staticconvert/staticconvert_windows_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//go:build windows | ||
|
||
package staticconvert_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/grafana/agent/internal/converter/internal/staticconvert" | ||
"github.com/grafana/agent/internal/converter/internal/test_common" | ||
_ "github.com/grafana/agent/internal/static/metrics/instance" // Imported to override default values via the init function. | ||
) | ||
|
||
func TestConvert(t *testing.T) { | ||
test_common.TestDirectory(t, "testdata", ".yaml", true, []string{"-config.expand-env"}, staticconvert.Convert) | ||
test_common.TestDirectory(t, "testdata-v2_windows", ".yaml", true, []string{"-enable-features", "integrations-next"}, staticconvert.Convert) | ||
test_common.TestDirectory(t, "testdata_windows", ".yaml", true, []string{"-config.expand-env"}, staticconvert.Convert) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
internal/converter/internal/staticconvert/testdata_windows/promtail_prom.diags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(Warning) Please review your agent command line flags and ensure they are set in your Flow mode config file where necessary. |
132 changes: 132 additions & 0 deletions
132
internal/converter/internal/staticconvert/testdata_windows/promtail_prom.river
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
discovery.consul "metrics_name_jobName" { | ||
services = ["myapp"] | ||
} | ||
|
||
prometheus.scrape "metrics_name_jobName" { | ||
targets = concat( | ||
discovery.consul.metrics_name_jobName.targets, | ||
[{ | ||
__address__ = "localhost:9099", | ||
}], | ||
[{ | ||
__address__ = "localhost:9101", | ||
}], | ||
) | ||
forward_to = [prometheus.remote_write.metrics_name.receiver] | ||
job_name = "jobName" | ||
} | ||
|
||
prometheus.remote_write "metrics_name" { | ||
endpoint { | ||
name = "name-149bbd" | ||
url = "http://localhost:9009/api/prom/push" | ||
|
||
queue_config { } | ||
|
||
metadata_config { } | ||
} | ||
} | ||
|
||
discovery.consul "logs_name_jobName" { | ||
datacenter = "bigdata" | ||
tag_separator = ";" | ||
scheme = "sketchy" | ||
username = "toby" | ||
password = "this_password_is_safe_innit?" | ||
allow_stale = false | ||
services = ["myapp"] | ||
tags = ["better", "faster", "stronger"] | ||
node_meta = { | ||
what = "this", | ||
where = "here", | ||
} | ||
refresh_interval = "10m0s" | ||
|
||
basic_auth { | ||
username = "toby" | ||
password = "this_password_is_safe_innit?" | ||
} | ||
} | ||
|
||
discovery.relabel "logs_name_jobName" { | ||
targets = discovery.consul.logs_name_jobName.targets | ||
|
||
rule { | ||
source_labels = ["host"] | ||
target_label = "hostname" | ||
} | ||
} | ||
|
||
local.file_match "logs_name_jobName" { | ||
path_targets = discovery.relabel.logs_name_jobName.output | ||
} | ||
|
||
loki.source.file "logs_name_jobName" { | ||
targets = local.file_match.logs_name_jobName.targets | ||
forward_to = [loki.write.logs_name.receiver] | ||
|
||
file_watch { | ||
min_poll_frequency = "1s" | ||
max_poll_frequency = "5s" | ||
} | ||
legacy_positions_file = "\\path\\name.yml" | ||
} | ||
|
||
loki.write "logs_name" { | ||
endpoint { | ||
url = "http://localhost/loki/api/v1/push" | ||
} | ||
external_labels = {} | ||
} | ||
|
||
discovery.consul "logs_name2_jobName" { | ||
datacenter = "bigdata" | ||
tag_separator = ";" | ||
scheme = "sketchy" | ||
username = "toby" | ||
password = "this_password_is_safe_innit?" | ||
allow_stale = false | ||
services = ["myapp"] | ||
tags = ["better", "faster", "stronger"] | ||
node_meta = { | ||
what = "this", | ||
where = "here", | ||
} | ||
refresh_interval = "10m0s" | ||
|
||
basic_auth { | ||
username = "toby" | ||
password = "this_password_is_safe_innit?" | ||
} | ||
} | ||
|
||
discovery.relabel "logs_name2_jobName" { | ||
targets = discovery.consul.logs_name2_jobName.targets | ||
|
||
rule { | ||
source_labels = ["host"] | ||
target_label = "hostname" | ||
} | ||
} | ||
|
||
local.file_match "logs_name2_jobName" { | ||
path_targets = discovery.relabel.logs_name2_jobName.output | ||
} | ||
|
||
loki.source.file "logs_name2_jobName" { | ||
targets = local.file_match.logs_name2_jobName.targets | ||
forward_to = [loki.write.logs_name2.receiver] | ||
|
||
file_watch { | ||
min_poll_frequency = "1s" | ||
max_poll_frequency = "5s" | ||
} | ||
legacy_positions_file = "\\path\\name2.yml" | ||
} | ||
|
||
loki.write "logs_name2" { | ||
endpoint { | ||
url = "http://localhost/loki/api/v1/push" | ||
} | ||
external_labels = {} | ||
} |
76 changes: 76 additions & 0 deletions
76
internal/converter/internal/staticconvert/testdata_windows/promtail_prom.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
metrics: | ||
global: | ||
remote_write: | ||
- url: http://localhost:9009/api/prom/push | ||
configs: | ||
- name: name | ||
host_filter: false | ||
scrape_configs: | ||
- job_name: 'jobName' | ||
static_configs: | ||
- targets: ['localhost:9099','localhost:9101'] | ||
consul_sd_configs: | ||
- server: 'localhost:8500' | ||
services: ['myapp'] | ||
|
||
logs: | ||
global: | ||
file_watch_config: | ||
min_poll_frequency: 1s | ||
max_poll_frequency: 5s | ||
positions_directory: /path | ||
configs: | ||
- name: name | ||
clients: | ||
- url: http://localhost/loki/api/v1/push | ||
scrape_configs: | ||
- job_name: jobName | ||
consul_sd_configs: | ||
- server: 'localhost:8500' | ||
datacenter: bigdata | ||
scheme: sketchy | ||
username: toby | ||
password: this_password_is_safe_innit? | ||
tags: | ||
- better | ||
- faster | ||
- stronger | ||
services: [ 'myapp' ] | ||
node_meta: | ||
where: here | ||
what: this | ||
tag_separator: ";" | ||
allow_stale: false | ||
refresh_interval: 10m | ||
|
||
relabel_configs: | ||
- source_labels: | ||
- host | ||
target_label: hostname | ||
- name: name2 | ||
clients: | ||
- url: http://localhost/loki/api/v1/push | ||
scrape_configs: | ||
- job_name: jobName | ||
consul_sd_configs: | ||
- server: 'localhost:8500' | ||
datacenter: bigdata | ||
scheme: sketchy | ||
username: toby | ||
password: this_password_is_safe_innit? | ||
tags: | ||
- better | ||
- faster | ||
- stronger | ||
services: [ 'myapp' ] | ||
node_meta: | ||
where: here | ||
what: this | ||
tag_separator: ";" | ||
allow_stale: false | ||
refresh_interval: 10m | ||
|
||
relabel_configs: | ||
- source_labels: | ||
- host | ||
target_label: hostname |