Skip to content

Fix flakes in TestMergeAlerts #4742

@SoloJacobs

Description

@SoloJacobs

Passes locally fine, but failed here: #4739 (comment)

go test -race  ./...
?   	github.com/prometheus/alertmanager/api	[no test files]
?   	github.com/prometheus/alertmanager/api/metrics	[no test files]
ok  	github.com/prometheus/alertmanager/api/v2	1.068s
?   	github.com/prometheus/alertmanager/api/v2/client	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/client/alert	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/client/alertgroup	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/client/general	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/client/receiver	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/client/silence	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/models	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations/alert	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations/alertgroup	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations/general	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver	[no test files]
?   	github.com/prometheus/alertmanager/api/v2/restapi/operations/silence	[no test files]
?   	github.com/prometheus/alertmanager/asset	[no test files]
ok  	github.com/prometheus/alertmanager/cli	1.056s
ok  	github.com/prometheus/alertmanager/cli/config	1.025s
?   	github.com/prometheus/alertmanager/cli/format	[no test files]
ok  	github.com/prometheus/alertmanager/cluster	3.304s
?   	github.com/prometheus/alertmanager/cluster/clusterpb	[no test files]
ok  	github.com/prometheus/alertmanager/cmd/alertmanager	1.051s
?   	github.com/prometheus/alertmanager/cmd/amtool	[no test files]
ok  	github.com/prometheus/alertmanager/config	1.141s
ok  	github.com/prometheus/alertmanager/config/receiver	1.037s
ok  	github.com/prometheus/alertmanager/dispatch	5.434s
?   	github.com/prometheus/alertmanager/examples/webhook	[no test files]
ok  	github.com/prometheus/alertmanager/featurecontrol	1.013s
ok  	github.com/prometheus/alertmanager/inhibit	1.031s
ok  	github.com/prometheus/alertmanager/matcher/compat	1.014s
ok  	github.com/prometheus/alertmanager/matcher/compliance	1.016s
ok  	github.com/prometheus/alertmanager/matcher/parse	1.029s
ok  	github.com/prometheus/alertmanager/nflog	2.031s
ok  	github.com/prometheus/alertmanager/nflog/nflogpb	1.009s
ok  	github.com/prometheus/alertmanager/notify	1.454s
ok  	github.com/prometheus/alertmanager/notify/discord	1.122s
ok  	github.com/prometheus/alertmanager/notify/email	4.897s
ok  	github.com/prometheus/alertmanager/notify/incidentio	1.912s
ok  	github.com/prometheus/alertmanager/notify/jira	1.375s
ok  	github.com/prometheus/alertmanager/notify/mattermost	1.133s
ok  	github.com/prometheus/alertmanager/notify/msteams	1.205s
ok  	github.com/prometheus/alertmanager/notify/msteamsv2	1.140s
ok  	github.com/prometheus/alertmanager/notify/opsgenie	1.106s
ok  	github.com/prometheus/alertmanager/notify/pagerduty	1.504s
ok  	github.com/prometheus/alertmanager/notify/pushover	1.148s
ok  	github.com/prometheus/alertmanager/notify/rocketchat	1.052s
ok  	github.com/prometheus/alertmanager/notify/slack	1.349s
ok  	github.com/prometheus/alertmanager/notify/sns	1.158s
ok  	github.com/prometheus/alertmanager/notify/telegram	1.120s
?   	github.com/prometheus/alertmanager/notify/test	[no test files]
ok  	github.com/prometheus/alertmanager/notify/victorops	1.161s
ok  	github.com/prometheus/alertmanager/notify/webex	1.075s
ok  	github.com/prometheus/alertmanager/notify/webhook	1.087s
ok  	github.com/prometheus/alertmanager/notify/wechat	1.075s
ok  	github.com/prometheus/alertmanager/pkg/labels	1.024s
?   	github.com/prometheus/alertmanager/pkg/modtimevfs	[no test files]
?   	github.com/prometheus/alertmanager/provider	[no test files]
ok  	github.com/prometheus/alertmanager/provider/mem	5.548s
ok  	github.com/prometheus/alertmanager/silence	2.063s
?   	github.com/prometheus/alertmanager/silence/silencepb	[no test files]
ok  	github.com/prometheus/alertmanager/store	1.028s
ok  	github.com/prometheus/alertmanager/template	1.092s
?   	github.com/prometheus/alertmanager/test/cli	[no test files]
ok  	github.com/prometheus/alertmanager/test/cli/acceptance	3.641s
?   	github.com/prometheus/alertmanager/test/with_api_v2	[no test files]
--- FAIL: TestMergeAlerts (5.06s)
    acceptance.go:178: failed to start alertmanager cluster: unable to get a successful response from the Alertmanager: Get "http://127.0.0.1:36357/api/v2/status": dial tcp 127.0.0.1:36357: connect: connection refused
    send_test.go:96: 
        collector "webhook":
        
        interval [2,2.5]
        ---
        - &{map[] 0001-01-01T00:00:00.000Z <nil> [] 0001-01-01T00:00:01.000Z <nil> <nil> { map[alertname:test]}}[1:]
          [ ✗ ]
        interval [3,3.5]
        ---
        - &{map[ann:v1] 0001-01-01T00:00:00.000Z <nil> [] 0001-01-01T00:00:01.000Z <nil> <nil> { map[alertname:test]}}[1:]
          [ ✗ ]
        interval [4,4.5]
        ---
        - &{map[ann:v2] 0001-01-01T00:00:00.000Z <nil> [] 0001-01-01T00:00:01.000Z <nil> <nil> { map[alertname:test]}}[1:]
          [ ✗ ]
        interval [5,5.5]
        ---
        - &{map[ann:v3] 0001-01-01T00:00:04.800Z <nil> [] 0001-01-01T00:00:01.000Z <nil> <nil> { map[alertname:test]}}[1:4.8]
          [ ✗ ]
        interval [6,6.5]
        ---
        - &{map[] 0001-01-01T00:00:00.000Z <nil> [] 0001-01-01T00:00:05.000Z <nil> <nil> { map[alertname:test]}}[5:]
          [ ✗ ]
        
        Expected total of 5 alerts, got 0
        received:
        
    acceptance.go:172: Error sending SIGTERM to Alertmanager process: no such process
    acceptance.go:172: stdout:
    acceptance.go:172: stderr:
        time=2025-11-14T16:14:59.547Z level=INFO source=main.go:188 msg="Starting Alertmanager" version="(version=0.29.0, branch=HEAD, revision=549ea51103ac6a6b7e8d68af331f28c056fbde68)"
        time=2025-11-14T16:14:59.547Z level=INFO source=main.go:189 msg="Build context" build_context="(go=go1.25.4, platform=linux/amd64, user=root@62df6f13b990, date=20251114-16:13:16, tags=netgo)"
        time=2025-11-14T16:14:59.547Z level=DEBUG source=cluster.go:180 msg="resolved peers to following addresses" component=cluster peers=127.0.0.1:36357
        time=2025-11-14T16:14:59.547Z level=DEBUG source=delegate.go:246 msg=NotifyJoin component=cluster node=01KA1JC2EVXF3B5411J0VY8B73 addr=127.0.0.1:36357
        time=2025-11-14T16:14:59.548Z level=DEBUG source=nflog.go:271 msg="notification log snapshot file doesn't exist" component=nflog err="open /tmp/am_test3659521531/nflog: no such file or directory"
        time=2025-11-14T16:14:59.548Z level=DEBUG source=silence.go:461 msg="silences snapshot file doesn't exist" component=silences err="open /tmp/am_test3659521531/silences: no such file or directory"
        time=2025-11-14T16:14:59.548Z level=DEBUG source=net.go:962 msg="[DEBUG] memberlist: Initiating push/pull sync with:  127.0.0.1:36357" component=cluster
        time=2025-11-14T16:14:59.548Z level=DEBUG source=net.go:238 msg="[DEBUG] memberlist: Stream connection from=127.0.0.1:44076" component=cluster
        time=2025-11-14T16:14:59.548Z level=DEBUG source=cluster.go:279 msg="joined cluster" component=cluster peers=1
        time=2025-11-14T16:14:59.548Z level=INFO source=cluster.go:685 msg="Waiting for gossip to settle..." component=cluster interval=2s
        time=2025-11-14T16:14:59.548Z level=INFO source=cluster.go:694 msg="gossip not settled but continuing anyway" component=cluster polls=0 elapsed=862ns
        time=2025-11-14T16:14:59.570Z level=DEBUG source=main.go:391 msg="external url" externalUrl=http://62df6f13b990:36357
        time=2025-11-14T16:14:59.570Z level=INFO source=coordinator.go:111 msg="Loading configuration file" component=configuration file=/tmp/am_test3659521531/config.yml
        time=2025-11-14T16:14:59.571Z level=INFO source=coordinator.go:124 msg="Completed loading of configuration file" component=configuration file=/tmp/am_test3659521531/config.yml
        time=2025-11-14T16:14:59.573Z level=WARN source=main.go:511 msg="repeat_interval is less than group_interval. Notifications will not repeat until the next group_interval." component=configuration repeat_interval=1ms group_interval=1s route={}
        time=2025-11-14T16:14:59.573Z level=DEBUG source=main.go:538 msg="route prefix" routePrefix=/
        time=2025-11-14T16:14:59.573Z level=ERROR source=main.go:559 msg="Listen error" err="listen tcp 127.0.0.1:36357: bind: address already in use"
        time=2025-11-14T16:14:59.573Z level=DEBUG source=cluster.go:579 msg="leaving cluster" component=cluster
        time=2025-11-14T16:14:59.573Z level=DEBUG source=delegate.go:252 msg=NotifyLeave component=cluster node=01KA1JC2EVXF3B5411J0VY8B73 addr=127.0.0.1:36357
        time=2025-11-14T16:14:59.573Z level=DEBUG source=cluster.go:529 msg="peer left" component=cluster peer=01KA1JC2EVXF3B5411J0VY8B73
        time=2025-11-14T16:14:59.573Z level=DEBUG source=nflog.go:330 msg="Running maintenance" component=nflog
        time=2025-11-14T16:14:59.574Z level=DEBUG source=silence.go:529 msg="Running maintenance" component=silences
        time=2025-11-14T16:14:59.574Z level=DEBUG source=silence.go:537 msg="Maintenance done" component=silences duration=357.119µs size=0
        time=2025-11-14T16:14:59.574Z level=DEBUG source=nflog.go:337 msg="Maintenance done" component=nflog duration=478.282µs size=0
FAIL
FAIL	github.com/prometheus/alertmanager/test/with_api_v2/acceptance	41.944s
ok  	github.com/prometheus/alertmanager/timeinterval	1.028s
ok  	github.com/prometheus/alertmanager/types	1.015s
?   	github.com/prometheus/alertmanager/ui	[no test files]
FAIL
make: *** [Makefile.common:154: common-test] Error 1
Error: Process completed with exit code 2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions