Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests fails when running them inside a Kubernetes cluster #8314

Open
HeavyWombat opened this issue Nov 7, 2024 · 0 comments
Open

Unit tests fails when running them inside a Kubernetes cluster #8314

HeavyWombat opened this issue Nov 7, 2024 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@HeavyWombat
Copy link

Describe the bug
Arguable a somewhat special edge case, but the introduction of DefaultOIDCDiscoveryBaseURL with its default value https://kubernetes.default.svc leads to a panic when trying to run the unit tests in a CI that runs in Kubernetes. I suspect that the initialization picks up that endpoint and can resolve it in-cluster and then tries to use it. Reason why I suspect this is that if you replace kubernetes.default.svc with something that cannot be resolved in-cluster, the test case does pass.

panic: test timed out after 10m0s
	running tests:
		TestReceiver (10m0s)
		TestReceiver/Dispatch_succeeded_-_Source_with_type (1m0s)

goroutine 244 [select]:
net/http.(*Transport).getConn(0x35a79e0, 0xc00029d810, {{}, 0x0, {0xc00037e4c0, 0x5}, {0xc00005b580, 0x1a}, 0x0})
	/usr/lib/golang/src/net/http/transport.go:1468 +0x4bd
net/http.(*Transport).roundTrip(0x35a79e0, 0xc0003d23c0)
	/usr/lib/golang/src/net/http/transport.go:633 +0xb54
net/http.(*Transport).RoundTrip(0x0?, 0x2453e60?)
	/usr/lib/golang/src/net/http/roundtrip.go:30 +0x13
net/http.send(0xc0003d23c0, {0x2453e60, 0x35a79e0}, {0xc0001ed301?, 0x41752b?, 0x0?})
	/usr/lib/golang/src/net/http/client.go:259 +0x5e4
net/http.(*Client).send(0x362db80, 0xc0003d23c0, {0xc00037e4de?, 0x21?, 0x0?})
	/usr/lib/golang/src/net/http/client.go:180 +0x98
net/http.(*Client).do(0x362db80, 0xc0003d23c0)
	/usr/lib/golang/src/net/http/client.go:725 +0x8bc
net/http.(*Client).Do(...)
	/usr/lib/golang/src/net/http/client.go:590
net/http.(*Client).Get(0x362db80, {0xc00037e4c0?, 0x2173689?})
	/usr/lib/golang/src/net/http/client.go:487 +0x5f
[knative.dev/eventing/pkg/auth.(*Verifier).getKubernetesOIDCDiscovery](http://knative.dev/eventing/pkg/auth.(*Verifier).getKubernetesOIDCDiscovery)(0xc00029cbe0?, 0xc0001f2bc0?, 0x362db80)
	/workspace/app/repo/src/eventing/pkg/auth/verifier.go:316 +0xb2
[knative.dev/eventing/pkg/auth.(*Verifier).initOIDCProvider](http://knative.dev/eventing/pkg/auth.(*Verifier).initOIDCProvider)(0xc00029cbe0, {0x2476780, 0xc00020a210}, 0xc00020a4b0)
	/workspace/app/repo/src/eventing/pkg/auth/verifier.go:248 +0xd2
[knative.dev/eventing/pkg/auth.NewVerifier](http://knative.dev/eventing/pkg/auth.NewVerifier)({0x2476780, 0xc00020a210}, {0x245f660, 0xc00036a890}, {0x245d0b8, 0xc0000a4740}, {0x245b900, 0xc000128280})
	/workspace/app/repo/src/eventing/pkg/auth/verifier.go:88 +0x5b5
[knative.dev/eventing/pkg/broker/filter.TestReceiver.func4(0xc0001476c0)](http://knative.dev/eventing/pkg/broker/filter.TestReceiver.func4(0xc0001476c0))
	/workspace/app/repo/src/eventing/pkg/broker/filter/filter_handler_test.go:456 +0x5a5
testing.tRunner(0xc0001476c0, 0xc00036a590)
	/usr/lib/golang/src/testing/testing.go:1690 +0xf4
created by testing.(*T).Run in goroutine 24
	/usr/lib/golang/src/testing/testing.go:1743 +0x390

FAIL	[knative.dev/eventing/pkg/broker/filter](http://knative.dev/eventing/pkg/broker/filter)	600.063s
panic: test timed out after 10m0s
	running tests:
		TestHandler_ServeHTTP (10m0s)
		TestHandler_ServeHTTP/malformed_request_URI (1m0s)

Expected behavior
Unit tests do run also in a Kubernetes provided containerized environment, if possible.

To Reproduce
Run unit tests inside a Kubernetes pod, e.g. Tekton setup.

Knative release version
v0.43.0
knative-v1.16.0

Additional context
n/a

@HeavyWombat HeavyWombat added the kind/bug Categorizes issue or PR as related to a bug. label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant