Skip to content

Commit

Permalink
Add eg.Wait
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Nov 21, 2023
1 parent 6e3c150 commit 2b0715b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/agent/core/ngt/handler/grpc/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ func Test_server_GetTimestamp(t *testing.T) {
BrokenIndexHistoryLimit: 1,
}

setup := func(t *testing.T) (context.Context, Server) {
setup := func(t *testing.T) (errgroup.Group, context.Context, Server) {
t.Helper()
ngt, err := service.New(&defaultConfig)
require.NoError(t, err)
Expand All @@ -1370,7 +1370,7 @@ func Test_server_GetTimestamp(t *testing.T) {
s, err := New(opts...)
require.NoError(t, err)

return ectx, s
return eg, ectx, s
}

type test struct {
Expand All @@ -1382,7 +1382,8 @@ func Test_server_GetTimestamp(t *testing.T) {
{
name: "succeeds to get object meta",
testfunc: func(t *testing.T) {
ectx, s := setup(t)
eg, ectx, s := setup(t)
defer eg.Wait()

// insert and create `num` index
num := 42
Expand Down Expand Up @@ -1413,7 +1414,8 @@ func Test_server_GetTimestamp(t *testing.T) {
{
name: "returns error when the given ID is invalid",
testfunc: func(t *testing.T) {
ectx, s := setup(t)
eg, ectx, s := setup(t)
defer eg.Wait()

_, err := s.GetTimestamp(ectx, &payload.Object_GetTimestampRequest{
Id: &payload.Object_ID{
Expand All @@ -1426,7 +1428,8 @@ func Test_server_GetTimestamp(t *testing.T) {
{
name: "returns error when the given ID is not found",
testfunc: func(t *testing.T) {
ectx, s := setup(t)
eg, ectx, s := setup(t)
defer eg.Wait()

_, err := s.GetTimestamp(ectx, &payload.Object_GetTimestampRequest{
Id: &payload.Object_ID{
Expand Down

0 comments on commit 2b0715b

Please sign in to comment.