Repository: prometheus/prometheus (language: go)

Issue:
[Bug] Zookeeper unit tests always fails on WSL2
**What happend:**
I am new to the community and would like to contribute, but I ran into a problem when I performed the following steps:
1. `make build` work fine.

2. `make test` without any changes, the test fails

```bash
make test 
>> cleaning generated parser
>> running goyacc to generate the .go file.

conflicts: 19 shift/reduce
>> checking generated parser
>> running all tests
go test -race  ./...
ok      github.com/prometheus/prometheus/cmd/prometheus (cached)
ok      github.com/prometheus/prometheus/cmd/promtool   (cached)
ok      github.com/prometheus/prometheus/config (cached)
ok      github.com/prometheus/prometheus/discovery      (cached)
ok      github.com/prometheus/prometheus/discovery/aws  (cached)
ok      github.com/prometheus/prometheus/discovery/azure        (cached)
ok      github.com/prometheus/prometheus/discovery/consul       (cached)
ok      github.com/prometheus/prometheus/discovery/digitalocean (cached)
ok      github.com/prometheus/prometheus/discovery/dns  (cached)
ok      github.com/prometheus/prometheus/discovery/eureka       (cached)
ok      github.com/prometheus/prometheus/discovery/file (cached)
?       github.com/prometheus/prometheus/discovery/gce  [no test files]
ok      github.com/prometheus/prometheus/discovery/hetzner      (cached)
ok      github.com/prometheus/prometheus/discovery/http (cached)
?       github.com/prometheus/prometheus/discovery/install      [no test files]
ok      github.com/prometheus/prometheus/discovery/ionos        (cached)
ok      github.com/prometheus/prometheus/discovery/kubernetes   (cached)
ok      github.com/prometheus/prometheus/discovery/linode       (cached)
ok      github.com/prometheus/prometheus/discovery/marathon     (cached)
ok      github.com/prometheus/prometheus/discovery/moby (cached)
ok      github.com/prometheus/prometheus/discovery/nomad        (cached)
ok      github.com/prometheus/prometheus/discovery/openstack    (cached)
ok      github.com/prometheus/prometheus/discovery/ovhcloud     (cached)
ok      github.com/prometheus/prometheus/discovery/puppetdb     (cached)
ok      github.com/prometheus/prometheus/discovery/refresh      (cached)
ok      github.com/prometheus/prometheus/discovery/scaleway     (cached)
ok      github.com/prometheus/prometheus/discovery/targetgroup  (cached)
ok      github.com/prometheus/prometheus/discovery/triton       (cached)
ok      github.com/prometheus/prometheus/discovery/uyuni        (cached)
ok      github.com/prometheus/prometheus/discovery/vultr        (cached)
ok      github.com/prometheus/prometheus/discovery/xds  (cached)
--- FAIL: TestNewDiscoveryError (0.01s)
    zookeeper_test.go:35: 
                Error Trace:    /home/zhengke-zhou/workplace/prometheus/discovery/zookeeper/zookeeper_test.go:35
                Error:          An error is expected but got nil.
                Test:           TestNewDiscoveryError
FAIL
FAIL    github.com/prometheus/prometheus/discovery/zookeeper    0.021s
ok      github.com/prometheus/prometheus/documentation/examples/custom-sd/adapter       (cached)
?       github.com/prometheus/prometheus/documentation/examples/custom-sd/adapter-usage [no test files]
?       github.com/prometheus/prometheus/model/exemplar [no test files]
ok      github.com/prometheus/prometheus/model/histogram        (cached)
ok      github.com/prometheus/prometheus/model/labels   (cached)
?       github.com/prometheus/prometheus/model/metadata [no test files]
ok      github.com/prometheus/prometheus/model/relabel  (cached)
ok      github.com/prometheus/prometheus/model/rulefmt  (cached)
ok      github.com/prometheus/prometheus/model/textparse        (cached)
?       github.com/prometheus/prometheus/model/timestamp        [no test files]
?       github.com/prometheus/prometheus/model/value    [no test files]
ok      github.com/prometheus/prometheus/notifier       (cached)
?       github.com/prometheus/prometheus/plugins        [no test files]
?       github.com/prometheus/prometheus/prompb [no test files]
ok      github.com/prometheus/prometheus/prompb/io/prometheus/client    (cached)
ok      github.com/prometheus/prometheus/prompb/io/prometheus/write/v2  (cached)
ok      github.com/prometheus/prometheus/prompb/rwcommon        (cached)
ok      github.com/prometheus/prometheus/promql (cached)
ok      github.com/prometheus/prometheus/promql/parser  (cached)
?       github.com/prometheus/prometheus/promql/parser/posrange [no test files]
ok      github.com/prometheus/prometheus/promql/promqltest      (cached)
ok      github.com/prometheus/prometheus/rules  (cached)
ok      github.com/prometheus/prometheus/scrape (cached)
ok      github.com/prometheus/prometheus/storage        (cached)
ok      github.com/prometheus/prometheus/storage/remote (cached)
ok      github.com/prometheus/prometheus/storage/remote/azuread (cached)
?       github.com/prometheus/prometheus/storage/remote/googleiam       [no test files]
ok      github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheus       (cached)
ok      github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheusremotewrite    (cached)
ok      github.com/prometheus/prometheus/template       (cached)
ok      github.com/prometheus/prometheus/tracing        (cached)
ok      github.com/prometheus/prometheus/tsdb   (cached)
ok      github.com/prometheus/prometheus/tsdb/agent     (cached)
ok      github.com/prometheus/prometheus/tsdb/chunkenc  (cached)
ok      github.com/prometheus/prometheus/tsdb/chunks    22.682s
?       github.com/prometheus/prometheus/tsdb/encoding  [no test files]
?       github.com/prometheus/prometheus/tsdb/errors    [no test files]
ok      github.com/prometheus/prometheus/tsdb/fileutil  (cached)
ok      github.com/prometheus/prometheus/tsdb/goversion (cached)
ok      github.com/prometheus/prometheus/tsdb/index     (cached)
ok      github.com/prometheus/prometheus/tsdb/record    (cached)
ok      github.com/prometheus/prometheus/tsdb/tombstones        (cached)
ok      github.com/prometheus/prometheus/tsdb/tsdbutil  (cached)
ok      github.com/prometheus/prometheus/tsdb/wlog      (cached)
ok      github.com/prometheus/prometheus/util/almost    (cached)
?       github.com/prometheus/prometheus/util/annotations       [no test files]
ok      github.com/prometheus/prometheus/util/convertnhcb       (cached)
?       github.com/prometheus/prometheus/util/documentcli       [no test files]
ok      github.com/prometheus/prometheus/util/fmtutil   (cached)
?       github.com/prometheus/prometheus/util/gate      [no test files]
ok      github.com/prometheus/prometheus/util/httputil  (cached)
?       github.com/prometheus/prometheus/util/jsonutil  [no test files]
ok      github.com/prometheus/prometheus/util/junitxml  (cached)
ok      github.com/prometheus/prometheus/util/logging   (cached)
ok      github.com/prometheus/prometheus/util/netconnlimit      (cached)
ok      github.com/prometheus/prometheus/util/notifications     (cached)
?       github.com/prometheus/prometheus/util/osutil    [no test files]
ok      github.com/prometheus/prometheus/util/pool      (cached)
?       github.com/prometheus/prometheus/util/runtime   [no test files]
?       github.com/prometheus/prometheus/util/runutil   [no test files]
ok      github.com/prometheus/prometheus/util/stats     (cached)
ok      github.com/prometheus/prometheus/util/strutil   (cached)
?       github.com/prometheus/prometheus/util/teststorage       [no test files]
?       github.com/prometheus/prometheus/util/testutil  [no test files]
?       github.com/prometheus/prometheus/util/treecache [no test files]
ok      github.com/prometheus/prometheus/util/zeropool  (cached)
ok      github.com/prometheus/prometheus/web    (cached)
ok      github.com/prometheus/prometheus/web/api/v1     (cached)
?       github.com/prometheus/prometheus/web/ui [no test files]
FAIL
make: *** [Makefile.common:153: common-test] Error 1
```

**OS:**
Windows10-22H2 - WSL2-Ubuntu20.04

**DEBUG:**
When I step through the debugger, everything works fine:
By calling `conn.hostProvider.Init(srvs)`, err appears in `dnshostprovider.go`
![Image](https://github.com/user-attachments/assets/7b25648e-e429-4c4c-94cb-7a015975e1ed)


Discussion / hints:
`discovery` tests don't run in the CI on windows https://github.com/prometheus/prometheus/blob/53be282396d395915010cbb59d08f8dcdb7a7f93/.github/workflows/ci.yml#L87
maybe it has something to do with timers.
But with https://github.com/golang/go/issues/44343 released in 1.23, we can give it a try again.

You can open a PR with `github.com/prometheus/prometheus/discovery.*|` removed and let's see what happen and maybe debug the zk issue.


Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 20fe7ddaf89..f37b02cb48b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -84,7 +84,7 @@ jobs:
         with:
           go-version: 1.24.x
       - run: |
-          $TestTargets = go list ./... | Where-Object { $_ -NotMatch "(github.com/prometheus/prometheus/discovery.*|github.com/prometheus/prometheus/config|github.com/prometheus/prometheus/web)"}
+          $TestTargets = go list ./... | Where-Object { $_ -NotMatch "(github.com/prometheus/prometheus/config|github.com/prometheus/prometheus/web)"}
           go test $TestTargets -vet=off -v
         shell: powershell
 


Test patch: