diff options
author | Rubén Dávila <ruben@gitlab.com> | 2018-08-07 15:33:27 +0300 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2018-08-07 15:33:27 +0300 |
commit | 2920f6ba003ca2dfa0b7f845194c3871b3884d65 (patch) | |
tree | ac5d645470b7f2d7d82bf08b4eca9c2885ffec6f | |
parent | c33913e9e4589186db126801817729299a316ffa (diff) |
Check push outputrd-test-gt
-rw-r--r-- | internal/service/smarthttp/receive_pack_test.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/service/smarthttp/receive_pack_test.go b/internal/service/smarthttp/receive_pack_test.go index 5b5adc3ce..8f1c2cc76 100644 --- a/internal/service/smarthttp/receive_pack_test.go +++ b/internal/service/smarthttp/receive_pack_test.go @@ -64,14 +64,16 @@ func TestReceivePackRequestWithGitOptions(t *testing.T) { require.NoError(t, err) // Test with a right MaxInputSize value - localCommitID, remoteCommitID := doPushWithOpts(t, repo, repoPath, stream, []string{"receive.MaxInputSize=10000"}) + localCommitID, remoteCommitID, pushOutput := doPushWithOpts(t, repo, repoPath, stream, []string{"receive.MaxInputSize=10000"}) require.Equal(t, localCommitID, remoteCommitID) + require.NotEqual(t, "", pushOutput) // Test with a wrong MaxInputSize value - localCommitID, remoteCommitID = doPushWithOpts(t, repo, repoPath, stream, []string{"receive.MaxInputSize=1"}) + localCommitID, remoteCommitID, pushOutput = doPushWithOpts(t, repo, repoPath, stream, []string{"receive.MaxInputSize=1"}) require.NotEqual(t, localCommitID, remoteCommitID) + require.Equal(t, "", pushOutput) } func TestFailedReceivePackRequestDueToValidationError(t *testing.T) { @@ -104,14 +106,14 @@ func TestFailedReceivePackRequestDueToValidationError(t *testing.T) { } } -func doPushWithOpts(t *testing.T, repo *pb.Repository, repoPath string, stream pb.SmartHTTPService_PostReceivePackClient, opts []string) (localCommitID string, remoteCommitID string) { +func doPushWithOpts(t *testing.T, repo *pb.Repository, repoPath string, stream pb.SmartHTTPService_PostReceivePackClient, opts []string) (localCommitID string, remoteCommitID string, pushOutput string) { push := newTestPush(t, []byte("hello world")) firstRequest := &pb.PostReceivePackRequest{Repository: repo, GlId: "user-123", GlRepository: "project-123", GitConfigOptions: opts} - doPush(t, stream, firstRequest, push.body) + pushOutput = string(doPush(t, stream, firstRequest, push.body)) remoteCommitID = strings.TrimSpace(string(testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "rev-parse", "HEAD"))) - return push.newHead, remoteCommitID + return push.newHead, remoteCommitID, pushOutput } func doPush(t *testing.T, stream pb.SmartHTTPService_PostReceivePackClient, firstRequest *pb.PostReceivePackRequest, body io.Reader) []byte { |