mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
e2e: accept context from Ginkgo
Every ginkgo callback should return immediately when a timeout occurs or the
test run manually gets aborted with CTRL-C. To do that, they must take a ctx
parameter and pass it through to all code which might block.
This is a first automated step towards that: the additional parameter got added
with
sed -i 's/\(framework.ConformanceIt\|ginkgo.It\)\(.*\)func() {$/\1\2func(ctx context.Context) {/' \
$(git grep -l -e framework.ConformanceIt -e ginkgo.It )
$GOPATH/bin/goimports -w $(git status | grep modified: | sed -e 's/.* //')
log_test.go was left unchanged.
This commit is contained in:
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
@@ -79,7 +81,7 @@ var _ = SIGDescribe("Networking", func() {
|
||||
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
|
||||
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
|
||||
*/
|
||||
framework.ConformanceIt("should function for intra-pod communication: http [NodeConformance]", func() {
|
||||
framework.ConformanceIt("should function for intra-pod communication: http [NodeConformance]", func(ctx context.Context) {
|
||||
config := e2enetwork.NewCoreNetworkingTestConfig(f, false)
|
||||
checkPodToPodConnectivity(config, "http", e2enetwork.EndpointHTTPPort)
|
||||
})
|
||||
@@ -90,7 +92,7 @@ var _ = SIGDescribe("Networking", func() {
|
||||
Description: Create a hostexec pod that is capable of curl to netcat commands. Create a test Pod that will act as a webserver front end exposing ports 8080 for tcp and 8081 for udp. The netserver service proxies are created on specified number of nodes.
|
||||
The kubectl exec on the webserver container MUST reach a udp port on the each of service proxy endpoints in the cluster and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
|
||||
*/
|
||||
framework.ConformanceIt("should function for intra-pod communication: udp [NodeConformance]", func() {
|
||||
framework.ConformanceIt("should function for intra-pod communication: udp [NodeConformance]", func(ctx context.Context) {
|
||||
config := e2enetwork.NewCoreNetworkingTestConfig(f, false)
|
||||
checkPodToPodConnectivity(config, "udp", e2enetwork.EndpointUDPPort)
|
||||
})
|
||||
@@ -102,7 +104,7 @@ var _ = SIGDescribe("Networking", func() {
|
||||
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=tcp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
|
||||
This test is marked LinuxOnly it breaks when using Overlay networking with Windows.
|
||||
*/
|
||||
framework.ConformanceIt("should function for node-pod communication: http [LinuxOnly] [NodeConformance]", func() {
|
||||
framework.ConformanceIt("should function for node-pod communication: http [LinuxOnly] [NodeConformance]", func(ctx context.Context) {
|
||||
config := e2enetwork.NewCoreNetworkingTestConfig(f, true)
|
||||
for _, endpointPod := range config.EndpointPods {
|
||||
err := config.DialFromNode("http", endpointPod.Status.PodIP, e2enetwork.EndpointHTTPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||
@@ -119,7 +121,7 @@ var _ = SIGDescribe("Networking", func() {
|
||||
The kubectl exec on the webserver container MUST reach a http port on the each of service proxy endpoints in the cluster using a http post(protocol=udp) and the request MUST be successful. Container will execute curl command to reach the service port within specified max retry limit and MUST result in reporting unique hostnames.
|
||||
This test is marked LinuxOnly it breaks when using Overlay networking with Windows.
|
||||
*/
|
||||
framework.ConformanceIt("should function for node-pod communication: udp [LinuxOnly] [NodeConformance]", func() {
|
||||
framework.ConformanceIt("should function for node-pod communication: udp [LinuxOnly] [NodeConformance]", func(ctx context.Context) {
|
||||
config := e2enetwork.NewCoreNetworkingTestConfig(f, true)
|
||||
for _, endpointPod := range config.EndpointPods {
|
||||
err := config.DialFromNode("udp", endpointPod.Status.PodIP, e2enetwork.EndpointUDPPort, config.MaxTries, 0, sets.NewString(endpointPod.Name))
|
||||
@@ -130,13 +132,13 @@ var _ = SIGDescribe("Networking", func() {
|
||||
})
|
||||
|
||||
// [Disruptive] because it conflicts with tests that call CheckSCTPModuleLoadedOnNodes
|
||||
ginkgo.It("should function for intra-pod communication: sctp [LinuxOnly][Feature:SCTPConnectivity][Disruptive]", func() {
|
||||
ginkgo.It("should function for intra-pod communication: sctp [LinuxOnly][Feature:SCTPConnectivity][Disruptive]", func(ctx context.Context) {
|
||||
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EnableSCTP)
|
||||
checkPodToPodConnectivity(config, "sctp", e2enetwork.EndpointSCTPPort)
|
||||
})
|
||||
|
||||
// [Disruptive] because it conflicts with tests that call CheckSCTPModuleLoadedOnNodes
|
||||
ginkgo.It("should function for node-pod communication: sctp [LinuxOnly][Feature:SCTPConnectivity][Disruptive]", func() {
|
||||
ginkgo.It("should function for node-pod communication: sctp [LinuxOnly][Feature:SCTPConnectivity][Disruptive]", func(ctx context.Context) {
|
||||
ginkgo.Skip("Skipping SCTP node to pod test until DialFromNode supports SCTP #96482")
|
||||
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EnableSCTP)
|
||||
for _, endpointPod := range config.EndpointPods {
|
||||
|
||||
Reference in New Issue
Block a user