Skip to content

Commit

Permalink
Improve TestProjectServiceServer_Load_ClientConnClosed
Browse files Browse the repository at this point in the history
  • Loading branch information
adambabik committed Jul 4, 2024
1 parent 3be21d6 commit 42d828f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/project/projectservice/project_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestProjectServiceServer_Load(t *testing.T) {
})
}

func TestProjectServiceServer_Load_ErrorWhileSending(t *testing.T) {
func TestProjectServiceServer_Load_ClientConnClosed(t *testing.T) {
t.Parallel()

temp := t.TempDir()
Expand All @@ -98,8 +98,10 @@ func TestProjectServiceServer_Load_ErrorWhileSending(t *testing.T) {
loadClient, err := client.Load(context.Background(), req)
require.NoError(t, err)

err = clientConn.Close()
require.NoError(t, err)
errc := make(chan error, 1)
go func() {
errc <- clientConn.Close()
}()

for {
_, err := loadClient.Recv()
Expand All @@ -108,6 +110,8 @@ func TestProjectServiceServer_Load_ErrorWhileSending(t *testing.T) {
break
}
}

require.NoError(t, <-errc)
}

func collectLoadEventTypes(client projectv1.ProjectService_LoadClient) ([]projectv1.LoadEventType, error) {
Expand Down

0 comments on commit 42d828f

Please sign in to comment.