Skip to content

Conversation

kkourt
Copy link
Contributor

@kkourt kkourt commented Mar 25, 2025

Fix e2e tests port-forwarding issues.

See commits.

kkourt added 2 commits March 25, 2025 14:55
There have been multiple port-forwarding failures for e2e tests in CI. Indeed, this is easy to reproduce
locally by running the followng test a few times:

```
$ go test -p 1 -parallel 1 -timeout 20m -count 1 -test.v \
	./tests/e2e/tests/skeleton                       \
	-tetragon.install-cilium=false                   \
	-tetragon.helm.version="v1.4.0"
```

The problem is that port-forwading fails at a point where we cannot recover.
What happens is:
 * tests wait for the tetragon daemonset to be ready
 * then, the test port-forwards all the ports
 * then, the test tries to connect to the local gRPC port
 * the port-forwader tries to connect to the pod address
 * if tetragon has not reached the point where it listens to the gRPC port, the port-forwarder fails
   and is destroyed.

This commit modifies the port forwarding code so that it also tries to connect to the gRPC port.
If it cannot, the port-fowarding will fail and we retry.

It also improves on the previous code that checks for the connection to
change by checking all possible states.

There is an innefficiency in the current version that we connect two
times: one as part of port-forwading and one in the connection
multiplezer. This will be addressed in the next patch.

Signed-off-by: Kornilios Kourtis <[email protected]>
The previous commit established a gRPC connection when we do the
port-forwarding. This ensured that the port-forwrding will not fail if
the tetragon agent is not ready when something tries to connect.

This commit uses the existing connections instead of redoing them.
The connections are closed when the test is done.

Signed-off-by: Kornilios Kourtis <[email protected]>
@kkourt kkourt added release-note/ci This PR makes changes to the CI. needs-backport/1.2 This PR needs backporting to 1.2 needs-backport/1.3 This PR needs backporting to 1.3 needs-backport/1.4 labels Mar 25, 2025
@kkourt kkourt requested a review from a team as a code owner March 25, 2025 14:27
@kkourt kkourt requested a review from jrfastab March 25, 2025 14:27
@kkourt kkourt changed the title Pr/kkourt/e2e port forwarding fixes e2e: port forwarding fixes Mar 25, 2025
@kkourt kkourt added the area/ci Related to CI label Mar 25, 2025
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kkourt kkourt merged commit 1365b31 into main Mar 26, 2025
46 checks passed
@kkourt kkourt deleted the pr/kkourt/e2e-port-forwarding-fixes branch March 26, 2025 07:03
This was referenced Mar 26, 2025
@kkourt kkourt added backport-done/1.4 backport-done/1.3 PR backport done. and removed needs-backport/1.4 needs-backport/1.3 This PR needs backporting to 1.3 labels Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Related to CI backport-done/1.3 PR backport done. backport-done/1.4 needs-backport/1.2 This PR needs backporting to 1.2 release-note/ci This PR makes changes to the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants