Skip to content

Commit

Permalink
Fix grpc tests patch after changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsimansk committed Jan 15, 2025
1 parent 5832d4d commit 79c22b5
Showing 1 changed file with 34 additions and 32 deletions.
66 changes: 34 additions & 32 deletions openshift/patches/004-grpc.patch
Original file line number Diff line number Diff line change
@@ -1,67 +1,69 @@
diff --git a/test/e2e/grpc_test.go b/test/e2e/grpc_test.go
index cab0aa22d..ee64c3b29 100644
index 404819ed4..f9d56f522 100644
--- a/test/e2e/grpc_test.go
+++ b/test/e2e/grpc_test.go
@@ -34,7 +34,6 @@ import (
@@ -34,6 +34,7 @@ import (

"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
- "google.golang.org/grpc/credentials"
+ "google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"

corev1 "k8s.io/api/core/v1"
@@ -68,9 +67,6 @@ func hasPort(u string) bool {
@@ -67,6 +68,9 @@ func hasPort(u string) bool {

func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
defaultPort := "80"
- if test.ServingFlags.HTTPS {
- defaultPort = "443"
- }
+ if test.ServingFlags.HTTPS {
+ defaultPort = "443"
+ }
if !hasPort(host) {
host = net.JoinHostPort(host, defaultPort)
}
@@ -83,12 +79,6 @@ func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
@@ -79,7 +83,12 @@ func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
}

creds := insecure.NewCredentials()
- if test.ServingFlags.HTTPS {
- tlsConfig := test.TLSClientConfig(context.Background(), ctx.t.Logf, ctx.clients)
- // Set ServerName for pseudo hostname with TLS.
- tlsConfig.ServerName = domain
- creds = credentials.NewTLS(tlsConfig)
- }
-
+ if test.ServingFlags.HTTPS {
+ tlsConfig := test.TLSClientConfig(context.Background(), ctx.t.Logf, ctx.clients)
+ // Set ServerName for pseudo hostname with TLS.
+ tlsConfig.ServerName = domain
+ creds = credentials.NewTLS(tlsConfig)
+ }
return grpc.Dial(
host,
@@ -324,11 +314,6 @@ func streamTest(tc *TestContext, host, domain string) {
grpc.WithAuthority(domain),
@@ -311,7 +320,11 @@ func streamTest(tc *TestContext, host, domain string) {

func testGRPC(t *testing.T, f grpcTest, fopts ...rtesting.ServiceOption) {
t.Helper()
- // TODO: https option with parallel leads to flakes.
- // https://github.com/knative/serving/issues/11387
- if !test.ServingFlags.HTTPS {
- t.Parallel()
- }
-
+ // TODO: https option with parallel leads to flakes.
+ // https://github.com/knative/serving/issues/11387
+ if !test.ServingFlags.HTTPS {
+ t.Parallel()
+ }
// Setup
clients := Setup(t)
@@ -369,16 +354,13 @@ func testGRPC(t *testing.T, f grpcTest, fopts ...rtesting.ServiceOption) {

@@ -351,13 +364,17 @@ func testGRPC(t *testing.T, f grpcTest, fopts ...rtesting.ServiceOption) {
}

host := url.Host
- if !test.ServingFlags.ResolvableDomain {
+ if true {
- if true {
+ if !test.ServingFlags.ResolvableDomain {
addr, mapper, err := ingress.GetIngressEndpoint(context.Background(), clients.KubeClient, pkgTest.Flags.IngressEndpoint)
if err != nil {
t.Fatal("Could not get service endpoint:", err)
}
- if test.ServingFlags.HTTPS {
- host = net.JoinHostPort(addr, mapper("443"))
- } else {
- host = net.JoinHostPort(addr, mapper("80"))
- }
+
+ host = net.JoinHostPort(addr, mapper("80"))
- host = net.JoinHostPort(addr, mapper("80"))
+ if test.ServingFlags.HTTPS {
+ host = net.JoinHostPort(addr, mapper("443"))
+ } else {
+ host = net.JoinHostPort(addr, mapper("80"))
+ }
}

f(&TestContext{

0 comments on commit 79c22b5

Please sign in to comment.