You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/03/25 20:55:28 UTC

[GitHub] [beam] Abacn commented on a change in pull request #17173: [BEAM-13918] Increase datastoreio go sdk unit test coverage

Abacn commented on a change in pull request #17173:
URL: https://github.com/apache/beam/pull/17173#discussion_r835604331



##########
File path: sdks/go/pkg/beam/io/datastoreio/datastore.go
##########
@@ -32,8 +32,20 @@ import (
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/log"
 	"google.golang.org/api/iterator"
+	"google.golang.org/api/option"
 )
 
+type clientType interface {
+	Run(context.Context, *datastore.Query) *datastore.Iterator
+	Close() error
+}
+
+// call to newClient returns an instance of datastore.Client
+// redirect this call for unit test usage
+var newClient = func(ctx context.Context, projectID string, opts ...option.ClientOption) (clientType, error) {

Review comment:
       Thanks so much for the suggestions! If I understood correctly, does the unit test then have to call the unexported `query` function directly, with a newClient function type?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org