diff --git a/.github/workflows/integration-tests-win.yml b/.github/workflows/integration-tests-win.yml new file mode 100644 index 0000000000..5716bbf54f --- /dev/null +++ b/.github/workflows/integration-tests-win.yml @@ -0,0 +1,21 @@ +name: Integration Tests Windows +on: + # Run tests on main just so the module and build cache can be saved and used + # in PRs. This speeds up the time it takes to test PRs dramatically. + # (More information on https://docs.github.com/en/enterprise-server@3.6/actions/using-workflows/caching-dependencies-to-speed-up-workflows) + push: + branches: + - main + pull_request: +jobs: + run_tests: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Run tests + run: make integration-test diff --git a/internal/cmd/integration-tests/tests/windows/config.alloy b/internal/cmd/integration-tests/tests/windows/config.alloy new file mode 100644 index 0000000000..aa795e229c --- /dev/null +++ b/internal/cmd/integration-tests/tests/windows/config.alloy @@ -0,0 +1,23 @@ +prometheus.exporter.windows "default" { } + +prometheus.scrape "default" { + targets = prometheus.exporter.windows.default.targets + forward_to = [prometheus.remote_write.default.receiver] + scrape_interval = "1s" + scrape_timeout = "500ms" +} + +prometheus.remote_write "default" { + endpoint { + url = "http://localhost:9009/api/v1/push" + metadata_config { + send_interval = "1s" + } + queue_config { + max_samples_per_send = 100 + } + } + external_labels = { + test_name = "win_metrics", + } +} \ No newline at end of file diff --git a/internal/cmd/integration-tests/tests/windows/windows_metrics_test.go b/internal/cmd/integration-tests/tests/windows/windows_metrics_test.go new file mode 100644 index 0000000000..0a083beb50 --- /dev/null +++ b/internal/cmd/integration-tests/tests/windows/windows_metrics_test.go @@ -0,0 +1,22 @@ +//go:build windows + +package main + +import ( + "testing" + + "github.com/grafana/alloy/internal/cmd/integration-tests/common" +) + +func TestWindowsMetrics(t *testing.T) { + var winMetrics = []string{ + "windows_cpu_logical_processor", // cpu + "windows_cs_logical_processors", // cs + "windows_logical_disk_info", // logical_disk + "windows_net_bytes_received_total", // net + "windows_os_info", // os + "windows_service_info", // service + "windows_system_processes", // system + } + common.MimirMetricsTest(t, winMetrics, []string{}, "win_metrics") +}