As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit ec516663 authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Rename Http to HTTP and comment

parent 5e3b490c
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 39 deletions
Loading
Loading
@@ -36,31 +36,31 @@ func TestClients(t *testing.T) {
}{
{
desc: "Socket client",
server: testserver.StartSocketHttpServer,
server: testserver.StartSocketHTTPServer,
secret: secret,
},
{
desc: "Socket client with a relative URL at /",
relativeURLRoot: "/",
server: testserver.StartSocketHttpServer,
server: testserver.StartSocketHTTPServer,
secret: secret,
},
{
desc: "Socket client with relative URL at /gitlab",
relativeURLRoot: "/gitlab",
server: testserver.StartSocketHttpServer,
server: testserver.StartSocketHTTPServer,
secret: secret,
},
{
desc: "Http client",
server: testserver.StartHttpServer,
server: testserver.StartHTTPServer,
secret: secret,
},
{
desc: "Https client",
caFile: path.Join(testRoot, "certs/valid/server.crt"),
server: func(t *testing.T, handlers []testserver.TestRequestHandler) string {
return testserver.StartHttpsServer(t, handlers, "")
return testserver.StartHTTPSServer(t, handlers, "")
},
secret: secret,
},
Loading
Loading
@@ -68,13 +68,13 @@ func TestClients(t *testing.T) {
desc: "Secret with newlines",
caFile: path.Join(testRoot, "certs/valid/server.crt"),
server: func(t *testing.T, handlers []testserver.TestRequestHandler) string {
return testserver.StartHttpsServer(t, handlers, "")
return testserver.StartHTTPSServer(t, handlers, "")
},
secret: "\n" + secret + "\n",
},
{
desc: "Retry client",
server: testserver.StartRetryHttpServer,
server: testserver.StartRetryHTTPServer,
secret: secret,
},
}
Loading
Loading
Loading
Loading
@@ -125,7 +125,7 @@ func TestRequestWithUserAgent(t *testing.T) {
}
func setup(t *testing.T, username, password string, requests []testserver.TestRequestHandler) *GitlabNetClient {
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
httpClient, err := NewHTTPClientWithOpts(url, "", "", "", 1, nil)
require.NoError(t, err)
Loading
Loading
Loading
Loading
@@ -123,7 +123,7 @@ func setupWithRequests(t *testing.T, caFile, caPath, clientCAPath, clientCertPat
},
}
url := testserver.StartHttpsServer(t, requests, clientCAPath)
url := testserver.StartHTTPSServer(t, requests, clientCAPath)
opts := defaultHttpOpts
if clientCertPath != "" && clientKeyPath != "" {
Loading
Loading
Loading
Loading
@@ -22,7 +22,8 @@ type TestRequestHandler struct {
Handler func(w http.ResponseWriter, r *http.Request)
}
func StartSocketHttpServer(t *testing.T, handlers []TestRequestHandler) string {
// StartSocketHTTPServer starts a socket based HTTP server
func StartSocketHTTPServer(t *testing.T, handlers []TestRequestHandler) string {
t.Helper()
// We can't use t.TempDir() here because it will create a directory that
Loading
Loading
@@ -55,7 +56,8 @@ func StartSocketHttpServer(t *testing.T, handlers []TestRequestHandler) string {
return url
}
func StartHttpServer(t *testing.T, handlers []TestRequestHandler) string {
// StartHTTPServer starts a TCP based HTTP server
func StartHTTPServer(t *testing.T, handlers []TestRequestHandler) string {
t.Helper()
server := httptest.NewServer(buildHandler(handlers))
Loading
Loading
@@ -64,7 +66,8 @@ func StartHttpServer(t *testing.T, handlers []TestRequestHandler) string {
return server.URL
}
func StartRetryHttpServer(t *testing.T, handlers []TestRequestHandler) string {
// StartRetryHTTPServer starts a TCP based HTTP server with retry capabilities
func StartRetryHTTPServer(t *testing.T, handlers []TestRequestHandler) string {
attempts := map[string]int{}
retryMiddileware := func(next func(w http.ResponseWriter, r *http.Request)) http.Handler {
Loading
Loading
@@ -92,7 +95,8 @@ func StartRetryHttpServer(t *testing.T, handlers []TestRequestHandler) string {
return server.URL
}
func StartHttpsServer(t *testing.T, handlers []TestRequestHandler, clientCAPath string) string {
// StartHTTPSServer starts a TCP based HTTPS capable server
func StartHTTPSServer(t *testing.T, handlers []TestRequestHandler, clientCAPath string) string {
t.Helper()
testRoot := testhelper.PrepareTestRootDir(t)
Loading
Loading
Loading
Loading
@@ -137,7 +137,7 @@ func startGitOverHTTPServer(t *testing.T) string {
},
}
return testserver.StartHttpServer(t, requests)
return testserver.StartHTTPServer(t, requests)
}
func buildAllowedResponse(t *testing.T, filename string) string {
Loading
Loading
Loading
Loading
@@ -43,7 +43,7 @@ var (
)
func TestExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
defaultConfig := &config.Config{RootDir: "/tmp", GitlabUrl: url}
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@ var requests = []testserver.TestRequestHandler{
}
func TestExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
@@ -96,7 +96,7 @@ func TestExecute(t *testing.T) {
}
func TestFailingExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ func TestGitAudit(t *testing.T) {
CommandType: commandargs.UploadArchive,
}
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
Audit(context.Background(), s.CommandType, &config.Config{GitlabUrl: url}, &accessverifier.Response{
Username: testUsername,
Repo: testRepo,
Loading
Loading
Loading
Loading
@@ -122,7 +122,7 @@ func TestPullExecuteWithFailedInfoRefs(t *testing.T) {
},
}
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
cmd := &PullCommand{
Config: &config.Config{GitlabUrl: url},
Loading
Loading
@@ -186,7 +186,7 @@ func setupPull(t *testing.T, uploadPackStatusCode int) string {
},
}
return testserver.StartHttpServer(t, requests)
return testserver.StartHTTPServer(t, requests)
}
func setupSSHPull(t *testing.T, uploadPackStatusCode int) string {
Loading
Loading
@@ -208,5 +208,5 @@ func setupSSHPull(t *testing.T, uploadPackStatusCode int) string {
},
}
return testserver.StartHttpServer(t, requests)
return testserver.StartHTTPServer(t, requests)
}
Loading
Loading
@@ -81,7 +81,7 @@ func TestExecuteWithFailedInfoRefs(t *testing.T) {
},
}
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
cmd := &PushCommand{
Config: &config.Config{GitlabUrl: url},
Loading
Loading
@@ -182,7 +182,7 @@ func setup(t *testing.T, receivePackStatusCode int) (string, io.Reader) {
},
}
return testserver.StartHttpServer(t, requests), input
return testserver.StartHTTPServer(t, requests), input
}
func setupSSHPush(t *testing.T, uploadPackStatusCode int) string {
Loading
Loading
@@ -204,5 +204,5 @@ func setupSSHPush(t *testing.T, uploadPackStatusCode int) string {
},
}
return testserver.StartHttpServer(t, requests)
return testserver.StartHTTPServer(t, requests)
}
Loading
Loading
@@ -45,7 +45,7 @@ func buildTestHandlers(code int, rsp *healthcheck.Response) []testserver.TestReq
}
func TestExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, okHandlers)
url := testserver.StartSocketHTTPServer(t, okHandlers)
buffer := &bytes.Buffer{}
cmd := &Command{
Loading
Loading
@@ -60,7 +60,7 @@ func TestExecute(t *testing.T) {
}
func TestFailingRedisExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, badRedisHandlers)
url := testserver.StartSocketHTTPServer(t, badRedisHandlers)
buffer := &bytes.Buffer{}
cmd := &Command{
Loading
Loading
@@ -74,7 +74,7 @@ func TestFailingRedisExecute(t *testing.T) {
}
func TestFailingAPIExecute(t *testing.T) {
url := testserver.StartSocketHttpServer(t, brokenHandlers)
url := testserver.StartSocketHTTPServer(t, brokenHandlers)
buffer := &bytes.Buffer{}
cmd := &Command{
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ import (
func TestFailedRequests(t *testing.T) {
requests := requesthandlers.BuildDisallowedByAPIHandlers(t)
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
@@ -124,7 +124,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
},
}
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
Loading
Loading
@@ -1465,7 +1465,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
},
}
url = testserver.StartHttpServer(t, requests)
url = testserver.StartHTTPServer(t, requests)
inputSource, inputSink := io.Pipe()
outputSource, outputSink := io.Pipe()
Loading
Loading
Loading
Loading
@@ -78,7 +78,7 @@ const (
func TestExecute(t *testing.T) {
setup(t)
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ func TestReceivePack(t *testing.T) {
t.Log(fmt.Sprintf("Server address: %s", gitalyAddress))
requests := requesthandlers.BuildAllowedWithGitalyHandlers(t, gitalyAddress)
url := testserver.StartHttpServer(t, requests)
url := testserver.StartHTTPServer(t, requests)
testCases := []struct {
username string
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ func TestCustomReceivePack(t *testing.T) {
}
func setup(t *testing.T, keyID string, requests []testserver.TestRequestHandler) (*Command, *bytes.Buffer) {
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
output := &bytes.Buffer{}
input := bytes.NewBufferString("input")
Loading
Loading
Loading
Loading
@@ -50,7 +50,7 @@ func setup(t *testing.T) (*Command, *bytes.Buffer, *bytes.Buffer) {
},
}
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
errBuf := &bytes.Buffer{}
outBuf := &bytes.Buffer{}
Loading
Loading
Loading
Loading
@@ -54,7 +54,7 @@ func TestExecuteEOFSent(t *testing.T) {
},
}
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
outBuf := &bytes.Buffer{}
errBuf := &bytes.Buffer{}
Loading
Loading
@@ -123,7 +123,7 @@ func TestExecuteNoEOFSent(t *testing.T) {
},
}
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
outBuf := &bytes.Buffer{}
errBuf := &bytes.Buffer{}
Loading
Loading
Loading
Loading
@@ -63,7 +63,7 @@ const (
func TestExecute(t *testing.T) {
setup(t)
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
Loading
Loading
@@ -93,7 +93,7 @@ const errorHeader = "OTP validation failed: "
func TestExecute(t *testing.T) {
requests := setup(t)
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
testCases := []struct {
desc string
Loading
Loading
@@ -173,7 +173,7 @@ func TestCanceledContext(t *testing.T) {
output := &bytes.Buffer{}
url := testserver.StartSocketHttpServer(t, requests)
url := testserver.StartSocketHTTPServer(t, requests)
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
Args: &commandargs.Shell{GitlabKeyId: "wait_infinitely"},
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment