Skip to content

Commit c77ff4a

Browse files
Merge pull request #30926 from jcmoraisjr/NE-2529-dcm-e2e-tests
NE-2529: add new dcm e2e tests
2 parents d036203 + e6739c8 commit c77ff4a

File tree

171 files changed

+17381
-14031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+17381
-14031
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ require (
6161
github.com/opencontainers/go-digest v1.0.0
6262
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260127124016-0fed2b824818
6363
github.com/openshift-kni/commatrix v0.0.5-0.20251111204857-e5a931eff73f
64-
github.com/openshift/api v0.0.0-20260302174620-dcac36b908db
64+
github.com/openshift/api v0.0.0-20260327065519-582dc3d316b7
6565
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31
6666
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee
67-
github.com/openshift/client-go v0.0.0-20260302182750-20813ce71ca6
67+
github.com/openshift/client-go v0.0.0-20260330134249-7e1499aaacd7
6868
github.com/openshift/library-go v0.0.0-20260303171201-5d9eb6295ff6
6969
github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250118001652-a8b9c3c31417
7070
github.com/pborman/uuid v1.2.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,14 +848,14 @@ github.com/openshift-eng/openshift-tests-extension v0.0.0-20260127124016-0fed2b8
848848
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260127124016-0fed2b824818/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
849849
github.com/openshift-kni/commatrix v0.0.5-0.20251111204857-e5a931eff73f h1:E72Zoc+JImPehBrXkgaCbIDbSFuItvyX6RCaZ0FQE5k=
850850
github.com/openshift-kni/commatrix v0.0.5-0.20251111204857-e5a931eff73f/go.mod h1:cDVdp0eda7EHE6tLuSeo4IqPWdAX/KJK+ogBirIGtsI=
851-
github.com/openshift/api v0.0.0-20260302174620-dcac36b908db h1:MOQ5JSIlbP4apwTrEdNpApT6PsnB0/1S6y9aKODp5Ks=
852-
github.com/openshift/api v0.0.0-20260302174620-dcac36b908db/go.mod h1:pyVjK0nZ4sRs4fuQVQ4rubsJdahI1PB94LnQ8sGdvxo=
851+
github.com/openshift/api v0.0.0-20260327065519-582dc3d316b7 h1:7AmoMSqTryaZu65nij6EACe8+DmlMlmR1giaUx5S5sQ=
852+
github.com/openshift/api v0.0.0-20260327065519-582dc3d316b7/go.mod h1:pyVjK0nZ4sRs4fuQVQ4rubsJdahI1PB94LnQ8sGdvxo=
853853
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31 h1:oYPQMrkzyk002L5aN8I2tkUHTEu9lsVrc1qiJmHJdXU=
854854
github.com/openshift/apiserver-library-go v0.0.0-20260303173613-cd3676268d31/go.mod h1:mnTsMMTtXSPBQzqBp5HXBjLvliveKenRADFQy9m5jc0=
855855
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee h1:+Sp5GGnjHDhT/a/nQ1xdp43UscBMr7G5wxsYotyhzJ4=
856856
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
857-
github.com/openshift/client-go v0.0.0-20260302182750-20813ce71ca6 h1:wJv4Ia+R4OxoaJcTUyvMtBc5rWFvfTiEA8d5f1MBPqI=
858-
github.com/openshift/client-go v0.0.0-20260302182750-20813ce71ca6/go.mod h1:3lkVff575BlbDUUhMsrD1IyvfkZ+oKUB7iZuVy1m0W0=
857+
github.com/openshift/client-go v0.0.0-20260330134249-7e1499aaacd7 h1:5GSoQlywIwYsRCw3qN+ZDmN6HrXTMZfI33bdRNm2jRQ=
858+
github.com/openshift/client-go v0.0.0-20260330134249-7e1499aaacd7/go.mod h1:HhXTUIMhgzxR3Ln/zEkr4QjTL0NN7A+t9Py/we9j2ug=
859859
github.com/openshift/kubernetes v0.0.0-20260305123649-d18f3f005eaa h1:4TK07egSJrny442x0Kl0HgzXgt2lnCKTKHF3sbL2U3E=
860860
github.com/openshift/kubernetes v0.0.0-20260305123649-d18f3f005eaa/go.mod h1:1r2FIoYrPU0110cjYlWAwNcbiqRPLWAgmZK4d0YeEZw=
861861
github.com/openshift/kubernetes/staging/src/k8s.io/api v0.0.0-20260305123649-d18f3f005eaa h1:ifOqAFthJWnT1HS6Sq2AcLQWNSJ1+XEiyA9eo+PIcR0=

test/extended/router/config_manager.go

Lines changed: 28 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"fmt"
66
"net"
7+
"net/http"
78
"strconv"
8-
"strings"
99
"time"
1010

1111
g "github.com/onsi/ginkgo/v2"
@@ -14,11 +14,11 @@ import (
1414
corev1 "k8s.io/api/core/v1"
1515
rbacv1 "k8s.io/api/rbac/v1"
1616
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17+
"k8s.io/apimachinery/pkg/labels"
1718
"k8s.io/apimachinery/pkg/types"
1819
"k8s.io/apimachinery/pkg/util/intstr"
1920
"k8s.io/apimachinery/pkg/util/sets"
2021
"k8s.io/apimachinery/pkg/util/wait"
21-
e2eoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
2222
"k8s.io/pod-security-admission/api"
2323
utilpointer "k8s.io/utils/pointer"
2424

@@ -832,77 +832,41 @@ const (
832832
)
833833

834834
func createRoute(oc *exutil.CLI, routeType routeType, routeName, serviceName, hostName, path string) error {
835-
var err error
836-
switch routeType {
837-
case routeTypeInsecure:
838-
// --labels on `oc expose` up to 4.21 does not override the ones coming from service's selector,
839-
// so we're labeling the router after creating it. https://issues.redhat.com/browse/OCPBUGS-74543
840-
err = oc.AsAdmin().Run("expose").Args("service", serviceName, "--name", routeName, "--hostname", hostName, "--path", path).Execute()
841-
case routeTypePassthrough:
842-
err = oc.AsAdmin().Run("create").Args("route", routeTypePassthrough, routeName, "--service", serviceName, "--hostname", hostName).Execute()
843-
default:
844-
err = oc.AsAdmin().Run("create").Args("route", string(routeType), routeName, "--service", serviceName, "--hostname", hostName, "--path", path).Execute()
835+
route := types.NamespacedName{
836+
Namespace: oc.Namespace(),
837+
Name: routeName,
845838
}
846-
if err != nil {
847-
return err
848-
}
849-
return oc.AsAdmin().Run("label").Args("route", routeName, "select=haproxy-cfgmgr").Execute()
839+
return createNamedRoute(context.Background(), oc, routeType, route, serviceName, hostName, path, nil, labels.Set{"select": "haproxy-cfgmgr"})
850840
}
851841

852842
func readURL(ns, execPodName, host, abspath, ipaddr string) (string, error) {
853-
host = exutil.IPUrl(host)
854-
proto := "http"
855-
port := 80
856-
uri := fmt.Sprintf("%s://%s:%d%s", proto, host, port, abspath)
857-
cmd := fmt.Sprintf("curl -ksfL -m 5 --resolve %s:%d:%s %q", host, port, ipaddr, uri)
858-
output, err := e2eoutput.RunHostCmd(ns, execPodName, cmd)
843+
execPod := execPodRef{
844+
NamespacedName: types.NamespacedName{
845+
Namespace: ns,
846+
Name: execPodName,
847+
},
848+
ipAddress: ipaddr,
849+
}
850+
secure := false
851+
code, output, err := execPodReadURL(execPod, host, secure, abspath)
859852
if err != nil {
860853
return "", err
861854
}
862-
return strings.TrimSpace(output), nil
855+
if code == 0 || code >= 400 {
856+
return "", fmt.Errorf("request failed: response code: %d output: %s", code, output)
857+
}
858+
return output, nil
863859
}
864860

865861
func waitForRouteToRespond(ns, execPodName, proto, host, abspath, ipaddr string, port int) error {
866-
// bracket IPv6 IPs when used as URI
867-
host = exutil.IPUrl(host)
868-
if port == 0 {
869-
switch proto {
870-
case "http":
871-
port = 80
872-
case "https":
873-
port = 443
874-
default:
875-
port = 80
876-
}
877-
}
878-
uri := fmt.Sprintf("%s://%s:%d%s", proto, host, port, abspath)
879-
cmd := fmt.Sprintf(`
880-
set -e
881-
STOP=$(($(date '+%%s') + %d))
882-
while [ $(date '+%%s') -lt $STOP ]; do
883-
rc=0
884-
code=$( curl -k -s -m 5 -o /dev/null -w '%%{http_code}\n' --resolve %s:%d:%s %q ) || rc=$?
885-
if [[ "${rc:-0}" -eq 0 ]]; then
886-
echo $code
887-
if [[ $code -eq 200 ]]; then
888-
exit 0
889-
fi
890-
if [[ $code -ne 503 ]]; then
891-
exit 1
892-
fi
893-
else
894-
echo "error ${rc}" 1>&2
895-
fi
896-
sleep 1
897-
done
898-
`, timeoutSeconds, host, port, ipaddr, uri)
899-
output, err := e2eoutput.RunHostCmd(ns, execPodName, cmd)
900-
if err != nil {
901-
return fmt.Errorf("host command failed: %v\n%s", err, output)
902-
}
903-
lines := strings.Split(strings.TrimSpace(output), "\n")
904-
if lines[len(lines)-1] != "200" {
905-
return fmt.Errorf("last response from server was not 200:\n%s", output)
862+
execPod := execPodRef{
863+
NamespacedName: types.NamespacedName{
864+
Namespace: ns,
865+
Name: execPodName,
866+
},
867+
ipAddress: ipaddr,
906868
}
907-
return nil
869+
secure := proto == "https"
870+
_, err := execPodWaitURL(context.Background(), execPod, host, secure, abspath, http.StatusOK, timeoutSeconds*time.Second)
871+
return err
908872
}

0 commit comments

Comments
 (0)