podresources: e2e: force eager connection
Add and use more facilities to the *internal* podresources client. Checking e2e test runs, we have quite some ``` rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /var/lib/kubelet/pod-resources/kubelet.sock: connect: connection refused": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /var/lib/kubelet/pod-resources/kubelet.sock: connect: connection refused" ``` This is likely caused by kubelet restarts, which we do plenty in e2e tests, combined with the fact gRPC does lazy connection AND we don't really check the errors in client code - we just bubble them up. While it's arguably bad we don't check properly error codes, it's also true that in the main case, e2e tests, the functions should just never fail besides few well known cases, we're connecting over a super-reliable unix domain socket after all. So, we centralize the fix adding a function (alongside with minor cleanups) which wants to trigger and ensure the connection happens, localizing the changes just here. The main advantage is this approach is opt-in, composable, and doesn't leak gRPC details into the client code. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
@@ -382,7 +382,7 @@ var _ = SIGDescribe("Memory Manager [Disruptive] [Serial] [Feature:MemoryManager
|
||||
endpoint, err := util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
cli, conn, err := podresources.GetV1Client(endpoint, defaultPodResourcesTimeout, defaultPodResourcesMaxSize)
|
||||
cli, conn, err := podresources.WaitForReady(podresources.GetClient(endpoint))
|
||||
framework.ExpectNoError(err)
|
||||
defer conn.Close()
|
||||
|
||||
@@ -522,7 +522,7 @@ var _ = SIGDescribe("Memory Manager [Disruptive] [Serial] [Feature:MemoryManager
|
||||
endpoint, err := util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
cli, conn, err := podresources.GetV1Client(endpoint, defaultPodResourcesTimeout, defaultPodResourcesMaxSize)
|
||||
cli, conn, err := podresources.WaitForReady(podresources.GetClient(endpoint))
|
||||
framework.ExpectNoError(err)
|
||||
defer conn.Close()
|
||||
|
||||
@@ -667,7 +667,7 @@ var _ = SIGDescribe("Memory Manager [Disruptive] [Serial] [Feature:MemoryManager
|
||||
endpoint, err := util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
cli, conn, err := podresources.GetV1Client(endpoint, defaultPodResourcesTimeout, defaultPodResourcesMaxSize)
|
||||
cli, conn, err := podresources.WaitForReady(podresources.GetClient(endpoint))
|
||||
framework.ExpectNoError(err)
|
||||
defer conn.Close()
|
||||
|
||||
@@ -684,7 +684,7 @@ var _ = SIGDescribe("Memory Manager [Disruptive] [Serial] [Feature:MemoryManager
|
||||
endpoint, err := util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
cli, conn, err := podresources.GetV1Client(endpoint, defaultPodResourcesTimeout, defaultPodResourcesMaxSize)
|
||||
cli, conn, err := podresources.WaitForReady(podresources.GetClient(endpoint))
|
||||
framework.ExpectNoError(err)
|
||||
defer conn.Close()
|
||||
|
||||
|
Reference in New Issue
Block a user