DRA e2e: more flexible socket listening

Instead of hard-coding two instances of the hostpathplugin which listen on
certain socket paths, the hostpathplugin now gets started through Pod exec as
needed. The advantage is that the helper code is in charge of socket naming,
just like it would be in real deployment.

One nuisance is that exec.StreamWithContext always complains in copyFromStdout
and copyFromStderr when the remote hostpathplugin gets killed via context
cancellation:

    E0312 11:56:31.637669  289446 v2.go:167] "Unhandled Error" err="next reader: read tcp [::1]:59006->[::1]:6444: use of closed network connection" logger="UnhandledError"
    E0312 11:56:31.637749  289446 v2.go:150] "Unhandled Error" err="next reader: read tcp [::1]:59006->[::1]:6444: use of closed network connection" logger="UnhandledError"

These can be ignored.
This commit is contained in:
Patrick Ohly
2025-03-12 09:49:19 +01:00
parent ec12727957
commit 1057407cee
3 changed files with 170 additions and 39 deletions

View File

@@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/kubernetes/test/utils/ktesting"
"k8s.io/klog/v2/ktesting"
)
func TestEndpointLifecycle(t *testing.T) {