Skip to content

Flaky Unit tests: fail when cluster is running, pass when cluster is deleted #4184

@Horiodino

Description

@Horiodino

Description

These tests fail when a real cluster is running locally but pass when the cluster is deleted.
This makes them flaky in local development.

Failure

=== SKIP: internal/controllers TestRegisterWithManager_OpAMPBridge (0.00s)
    opampbridge_controller_test.go:159: this test requires a real cluster, otherwise the GetConfigOrDie will die

=== SKIP: internal/controllers TestRegisterWithManager (0.00s)
    reconcile_test.go:1188: this test requires a real cluster, otherwise the GetConfigOrDie will die

=== FAIL: cmd/otel-allocator/internal/collector Test_runWatch/pod_add (30.75s)
W0711 12:25:54.585053  487575 shared_informer.go:591] resyncPeriod 2ms is too small. Changing it to the minimum allowed value of 1s
    collector_test.go:201: 
        	Error Trace:	/home/kalki/Documents/opentelemetry-operator/cmd/otel-allocator/internal/collector/collector_test.go:204
        	Error:      	"map[test-pod1:test-pod1]" should have 3 item(s), but has 1
    collector_test.go:201: 
        	Error Trace:	/home/kalki/Documents/opentelemetry-operator/cmd/otel-allocator/internal/collector/collector_test.go:205
        	Error:      	Not equal: 
        	           	expected: map[string]*allocation.Collector{"test-pod1":..., "test-pod2":..., "test-pod3":...}
        	           	actual  : map[string]*allocation.Collector{"test-pod1":...}
        	Diff:
        	--- Expected
        	+++ Actual
        	@@ -1,14 +1,4 @@
        	-(map[string]*allocation.Collector) (len=3) {
        	+(map[string]*allocation.Collector) (len=1) {
        	 (string) (len=9) "test-pod1": (*allocation.Collector)({
        	  Name: (string) (len=9) "test-pod1",
        	-  NodeName: (string) (len=9) "test-node",
        	-  NumTargets: (int) 0
        	- }),
        	- (string) (len=9) "test-pod2": (*allocation.Collector)({
        	-  Name: (string) (len=9) "test-pod2",
        	-  NodeName: (string) (len=9) "test-node",
        	-  NumTargets: (int) 0
        	- }),
        	- (string) (len=9) "test-pod3": (*allocation.Collector)({
        	-  Name: (string) (len=9) "test-pod3",
        	  NodeName: (string) (len=9) "test-node",

    collector_test.go:201: 
        	Error Trace:	/home/kalki/Documents/opentelemetry-operator/cmd/otel-allocator/internal/collector/collector_test.go:201
        	Error:      	Condition never satisfied
        	Test:       	Test_runWatch/pod_add

=== FAIL: cmd/otel-allocator/internal/collector Test_runWatch (30.86s)

DONE 1797 tests, 2 skipped, 2 failures in 34.799s
make: *** [Makefile:298: test] Error 1

Reproduce

make test

Branch and commit

Branch: main
Latest commit:

commit ef60b5746a3868e1e26691fac8dfb9681e1fe5d8 (HEAD -> main, origin/main, origin/HEAD)
Author: Mikhail Chinkov <mikhail.chinkov@coralogix.com>
Date:   Thu Jul 10 18:54:00 2025 +0200

    fix/target-allocator: check CRDs availability in the cluster (#4118)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions