Commit aa34b2ac authored by Alessio Caiazza's avatar Alessio Caiazza

Merge branch 'jv-test-gitaly-graceful-stop' into 'master'

Tests: block until grpc server has stopped

Closes #281

See merge request gitlab-org/gitlab-workhorse!576
parents e37bedb1 4143d645
...@@ -58,7 +58,7 @@ func TestFailedCloneNoGitaly(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestFailedCloneNoGitaly(t *testing.T) {
func TestGetInfoRefsProxiedToGitalySuccessfully(t *testing.T) { func TestGetInfoRefsProxiedToGitalySuccessfully(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
...@@ -143,7 +143,7 @@ func TestGetInfoRefsProxiedToGitalySuccessfully(t *testing.T) { ...@@ -143,7 +143,7 @@ func TestGetInfoRefsProxiedToGitalySuccessfully(t *testing.T) {
func TestGetInfoRefsProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetInfoRefsProxiedToGitalyInterruptedStream(t *testing.T) {
apiResponse := gitOkBody(t) apiResponse := gitOkBody(t)
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
apiResponse.GitalyServer.Address = gitalyAddress apiResponse.GitalyServer.Address = gitalyAddress
...@@ -184,7 +184,7 @@ func TestPostReceivePackProxiedToGitalySuccessfully(t *testing.T) { ...@@ -184,7 +184,7 @@ func TestPostReceivePackProxiedToGitalySuccessfully(t *testing.T) {
apiResponse := gitOkBody(t) apiResponse := gitOkBody(t)
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
apiResponse.GitalyServer.Address = "unix:" + socketPath apiResponse.GitalyServer.Address = "unix:" + socketPath
apiResponse.GitConfigOptions = []string{"git-config-hello=world"} apiResponse.GitConfigOptions = []string{"git-config-hello=world"}
...@@ -230,7 +230,7 @@ func TestPostReceivePackProxiedToGitalyInterrupted(t *testing.T) { ...@@ -230,7 +230,7 @@ func TestPostReceivePackProxiedToGitalyInterrupted(t *testing.T) {
apiResponse := gitOkBody(t) apiResponse := gitOkBody(t)
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
apiResponse.GitalyServer.Address = "unix:" + socketPath apiResponse.GitalyServer.Address = "unix:" + socketPath
ts := testAuthServer(nil, nil, 200, apiResponse) ts := testAuthServer(nil, nil, 200, apiResponse)
...@@ -280,7 +280,7 @@ func TestPostUploadPackProxiedToGitalySuccessfully(t *testing.T) { ...@@ -280,7 +280,7 @@ func TestPostUploadPackProxiedToGitalySuccessfully(t *testing.T) {
apiResponse.ShowAllRefs = tc.showAllRefs apiResponse.ShowAllRefs = tc.showAllRefs
gitalyServer, socketPath := startGitalyServer(t, tc.code) gitalyServer, socketPath := startGitalyServer(t, tc.code)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
apiResponse.GitalyServer.Address = "unix:" + socketPath apiResponse.GitalyServer.Address = "unix:" + socketPath
ts := testAuthServer(nil, nil, 200, apiResponse) ts := testAuthServer(nil, nil, 200, apiResponse)
...@@ -347,7 +347,7 @@ func TestPostUploadPackProxiedToGitalyInterrupted(t *testing.T) { ...@@ -347,7 +347,7 @@ func TestPostUploadPackProxiedToGitalyInterrupted(t *testing.T) {
apiResponse := gitOkBody(t) apiResponse := gitOkBody(t)
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
apiResponse.GitalyServer.Address = "unix:" + socketPath apiResponse.GitalyServer.Address = "unix:" + socketPath
ts := testAuthServer(nil, nil, 200, apiResponse) ts := testAuthServer(nil, nil, 200, apiResponse)
...@@ -379,7 +379,7 @@ func TestPostUploadPackProxiedToGitalyInterrupted(t *testing.T) { ...@@ -379,7 +379,7 @@ func TestPostUploadPackProxiedToGitalyInterrupted(t *testing.T) {
func TestGetDiffProxiedToGitalySuccessfully(t *testing.T) { func TestGetDiffProxiedToGitalySuccessfully(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -399,7 +399,7 @@ func TestGetDiffProxiedToGitalySuccessfully(t *testing.T) { ...@@ -399,7 +399,7 @@ func TestGetDiffProxiedToGitalySuccessfully(t *testing.T) {
func TestGetPatchProxiedToGitalySuccessfully(t *testing.T) { func TestGetPatchProxiedToGitalySuccessfully(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -419,7 +419,7 @@ func TestGetPatchProxiedToGitalySuccessfully(t *testing.T) { ...@@ -419,7 +419,7 @@ func TestGetPatchProxiedToGitalySuccessfully(t *testing.T) {
func TestGetBlobProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetBlobProxiedToGitalyInterruptedStream(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -445,7 +445,7 @@ func TestGetBlobProxiedToGitalyInterruptedStream(t *testing.T) { ...@@ -445,7 +445,7 @@ func TestGetBlobProxiedToGitalyInterruptedStream(t *testing.T) {
func TestGetArchiveProxiedToGitalySuccessfully(t *testing.T) { func TestGetArchiveProxiedToGitalySuccessfully(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -486,7 +486,7 @@ func TestGetArchiveProxiedToGitalySuccessfully(t *testing.T) { ...@@ -486,7 +486,7 @@ func TestGetArchiveProxiedToGitalySuccessfully(t *testing.T) {
func TestGetArchiveProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetArchiveProxiedToGitalyInterruptedStream(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -514,7 +514,7 @@ func TestGetArchiveProxiedToGitalyInterruptedStream(t *testing.T) { ...@@ -514,7 +514,7 @@ func TestGetArchiveProxiedToGitalyInterruptedStream(t *testing.T) {
func TestGetDiffProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetDiffProxiedToGitalyInterruptedStream(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -541,7 +541,7 @@ func TestGetDiffProxiedToGitalyInterruptedStream(t *testing.T) { ...@@ -541,7 +541,7 @@ func TestGetDiffProxiedToGitalyInterruptedStream(t *testing.T) {
func TestGetPatchProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetPatchProxiedToGitalyInterruptedStream(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
repoStorage := "default" repoStorage := "default"
...@@ -568,7 +568,7 @@ func TestGetPatchProxiedToGitalyInterruptedStream(t *testing.T) { ...@@ -568,7 +568,7 @@ func TestGetPatchProxiedToGitalyInterruptedStream(t *testing.T) {
func TestGetSnapshotProxiedToGitalySuccessfully(t *testing.T) { func TestGetSnapshotProxiedToGitalySuccessfully(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
expectedBody := testhelper.GitalyGetSnapshotResponseMock expectedBody := testhelper.GitalyGetSnapshotResponseMock
...@@ -590,7 +590,7 @@ func TestGetSnapshotProxiedToGitalySuccessfully(t *testing.T) { ...@@ -590,7 +590,7 @@ func TestGetSnapshotProxiedToGitalySuccessfully(t *testing.T) {
func TestGetSnapshotProxiedToGitalyInterruptedStream(t *testing.T) { func TestGetSnapshotProxiedToGitalyInterruptedStream(t *testing.T) {
gitalyServer, socketPath := startGitalyServer(t, codes.OK) gitalyServer, socketPath := startGitalyServer(t, codes.OK)
defer gitalyServer.Stop() defer gitalyServer.GracefulStop()
gitalyAddress := "unix:" + socketPath gitalyAddress := "unix:" + socketPath
......
...@@ -80,7 +80,7 @@ func startSmartHTTPServer(t testing.TB, s gitalypb.SmartHTTPServiceServer) (stri ...@@ -80,7 +80,7 @@ func startSmartHTTPServer(t testing.TB, s gitalypb.SmartHTTPServiceServer) (stri
}() }()
return fmt.Sprintf("%s://%s", ln.Addr().Network(), ln.Addr().String()), func() { return fmt.Sprintf("%s://%s", ln.Addr().Network(), ln.Addr().String()), func() {
srv.Stop() srv.GracefulStop()
assert.NoError(t, os.RemoveAll(tmp), "error removing temp dir %q", tmp) assert.NoError(t, os.RemoveAll(tmp), "error removing temp dir %q", tmp)
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment