Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-16 14:13:25 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-11-23 16:11:00 +0300
commit3e4145966d490850086dc3ffcf3062e53451bb38 (patch)
treef4b7d6d37009f379dd143d95618b8ae0f1366348
parent4157777e97a00568303b8611aaa8dbbad3028e48 (diff)
repository: Rename file hosting `CreateRepositoryFromURL()`
Rename the file hosting the `CreateRepositoryFromURL()` RPC implementation to better reflect what it contains. Adjust test names while at it.
-rw-r--r--internal/gitaly/service/repository/create_repository_from_url.go (renamed from internal/gitaly/service/repository/create_from_url.go)0
-rw-r--r--internal/gitaly/service/repository/create_repository_from_url_test.go (renamed from internal/gitaly/service/repository/create_from_url_test.go)54
2 files changed, 27 insertions, 27 deletions
diff --git a/internal/gitaly/service/repository/create_from_url.go b/internal/gitaly/service/repository/create_repository_from_url.go
index e12c0c875..e12c0c875 100644
--- a/internal/gitaly/service/repository/create_from_url.go
+++ b/internal/gitaly/service/repository/create_repository_from_url.go
diff --git a/internal/gitaly/service/repository/create_from_url_test.go b/internal/gitaly/service/repository/create_repository_from_url_test.go
index 1edf97796..38a0dd78d 100644
--- a/internal/gitaly/service/repository/create_from_url_test.go
+++ b/internal/gitaly/service/repository/create_repository_from_url_test.go
@@ -18,7 +18,7 @@ import (
"google.golang.org/grpc/codes"
)
-func TestSuccessfulCreateRepositoryFromURLRequest(t *testing.T) {
+func TestCreateRepotitoryFromURL_successful(t *testing.T) {
t.Parallel()
cfg, _, repoPath, client := setupRepositoryService(t)
@@ -57,31 +57,7 @@ func TestSuccessfulCreateRepositoryFromURLRequest(t *testing.T) {
require.True(t, os.IsNotExist(err), "hooks directory should not have been created")
}
-func TestCloneRepositoryFromUrlCommand(t *testing.T) {
- t.Parallel()
- ctx, cancel := testhelper.Context()
- defer cancel()
-
- userInfo := "user:pass%21%3F%40"
- repositoryFullPath := "full/path/to/repository"
- url := fmt.Sprintf("https://%s@www.example.com/secretrepo.git", userInfo)
-
- cfg := testcfg.Build(t)
- s := server{cfg: cfg, gitCmdFactory: git.NewExecCommandFactory(cfg)}
- cmd, err := s.cloneFromURLCommand(ctx, &gitalypb.Repository{}, url, repositoryFullPath, nil)
- require.NoError(t, err)
-
- expectedScrubbedURL := "https://www.example.com/secretrepo.git"
- expectedBasicAuthHeader := fmt.Sprintf("Authorization: Basic %s", base64.StdEncoding.EncodeToString([]byte("user:pass!?@")))
- expectedHeader := fmt.Sprintf("http.extraHeader=%s", expectedBasicAuthHeader)
-
- args := cmd.Args()
- require.Contains(t, args, expectedScrubbedURL)
- require.Contains(t, args, expectedHeader)
- require.NotContains(t, args, userInfo)
-}
-
-func TestFailedCreateRepositoryFromURLRequestDueToExistingTarget(t *testing.T) {
+func TestCreateRepositoryFromURL_existingTarget(t *testing.T) {
t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
@@ -131,7 +107,7 @@ func TestFailedCreateRepositoryFromURLRequestDueToExistingTarget(t *testing.T) {
}
}
-func TestPreventingRedirect(t *testing.T) {
+func TestCreateRepositoryFromURL_redirect(t *testing.T) {
t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
@@ -160,6 +136,30 @@ func TestPreventingRedirect(t *testing.T) {
require.Contains(t, err.Error(), "The requested URL returned error: 301")
}
+func TestCloneRepositoryFromUrlCommand(t *testing.T) {
+ t.Parallel()
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ userInfo := "user:pass%21%3F%40"
+ repositoryFullPath := "full/path/to/repository"
+ url := fmt.Sprintf("https://%s@www.example.com/secretrepo.git", userInfo)
+
+ cfg := testcfg.Build(t)
+ s := server{cfg: cfg, gitCmdFactory: git.NewExecCommandFactory(cfg)}
+ cmd, err := s.cloneFromURLCommand(ctx, &gitalypb.Repository{}, url, repositoryFullPath, nil)
+ require.NoError(t, err)
+
+ expectedScrubbedURL := "https://www.example.com/secretrepo.git"
+ expectedBasicAuthHeader := fmt.Sprintf("Authorization: Basic %s", base64.StdEncoding.EncodeToString([]byte("user:pass!?@")))
+ expectedHeader := fmt.Sprintf("http.extraHeader=%s", expectedBasicAuthHeader)
+
+ args := cmd.Args()
+ require.Contains(t, args, expectedScrubbedURL)
+ require.Contains(t, args, expectedHeader)
+ require.NotContains(t, args, userInfo)
+}
+
func gitServerWithBasicAuth(t testing.TB, cfg config.Cfg, user, pass, repoPath string) (int, func() error) {
return gittest.GitServer(t, cfg, repoPath, basicAuthMiddleware(t, user, pass))
}