Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
ref(e2e): consolidate HTTP request host, port, and path into one field (
Browse files Browse the repository at this point in the history
  • Loading branch information
nojnhuh authored Oct 15, 2020
1 parent 814c2c7 commit c9393ef
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
9 changes: 3 additions & 6 deletions tests/e2e/common_traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ type HTTPRequestDef struct {
SourcePod string
SourceContainer string

// Either host or IP, ie. "server", "server1.server", "192.168.0.1"
// The entire destination URL processed by curl, including host name and
// optionally protocol, port, and path
Destination string
// HTTP path on url, ie. "/index.html"
HTTPUrl string
// TCP port on request
Port int
}

// HTTPRequestResult represents results of an HTTPRequest call
Expand All @@ -42,7 +39,7 @@ type HTTPRequestResult struct {
func (td *OsmTestData) HTTPRequest(ht HTTPRequestDef) HTTPRequestResult {
// -s silent progress, -o output to devnull, '-D -' dump headers to "-" (stdout), -i Status code
// -I skip body download, '-w StatusCode:%{http_code}' prints Status code label-like for easy parsing
command := fmt.Sprintf("/usr/bin/curl -s -o /dev/null -D - -I -w %s:%%{http_code} http://%s:%d%s", StatusCodeWord, ht.Destination, ht.Port, ht.HTTPUrl)
command := fmt.Sprintf("/usr/bin/curl -s -o /dev/null -D - -I -w %s:%%{http_code} %s", StatusCodeWord, ht.Destination)

stdout, stderr, err := td.RunRemote(ht.SourceNs, ht.SourcePod, ht.SourceContainer, command)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_deployment_client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ var _ = Describe("Test HTTP traffic from N deployment client -> 1 deployment ser
SourceContainer: ns, // container_name == NS for this test

Destination: fmt.Sprintf("%s.%s", destApp, destApp),

HTTPUrl: "/",
Port: 80,
})
}
}
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_hashivault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ var _ = Describe("1 Client pod -> 1 Server pod test using Vault", func() {
SourceContainer: "client", // We can do better

Destination: fmt.Sprintf("%s.%s", dstPod.Name, dstPod.Namespace),

HTTPUrl: "/",
Port: 80,
})

if result.Err != nil || result.StatusCode != 200 {
Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/e2e_pod_client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ var _ = Describe("Test HTTP traffic from 1 pod client -> 1 pod server", func() {
SourceContainer: sourceName,

Destination: fmt.Sprintf("%s.%s", dstPod.Name, dstPod.Namespace),
HTTPUrl: "/",
Port: 80,
}

srcToDestStr := fmt.Sprintf("%s -> %s",
fmt.Sprintf("%s/%s", sourceName, srcPod.Name),
fmt.Sprintf("%s:%d%s", clientToServer.Destination, clientToServer.Port, clientToServer.HTTPUrl))
clientToServer.Destination)

cond := td.WaitForRepeatedSuccess(func() bool {
result := td.HTTPRequest(clientToServer)
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/e2e_trafficsplit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ var _ = Describe("Test HTTP from N Clients deployments to 1 Server deployment ba

// Targeting the trafficsplit FQDN
Destination: fmt.Sprintf("%s.%s", trafficSplitName, serverNamespace),

HTTPUrl: "/",
Port: 80,
})
}
}
Expand Down

0 comments on commit c9393ef

Please sign in to comment.