jrmccluskey commented on code in PR #26065:
URL: https://github.com/apache/beam/pull/26065#discussion_r1156160371


##########
sdks/go/pkg/beam/io/filesystem/gcs/gcs_test.go:
##########
@@ -36,3 +40,238 @@ func TestGCS_FilesystemNew(t *testing.T) {
                t.Errorf("c.Close() = %v, want nil", err)
        }
 }
+
+func TestGCS_direct(t *testing.T) {
+       ctx := context.Background()
+       dirPath := "gs://beamgogcsfilesystemtest"
+       filePath := dirPath + "/file.txt"
+
+       server := fakestorage.NewServer([]fakestorage.Object{
+               {
+                       ObjectAttrs: fakestorage.ObjectAttrs{
+                               BucketName: "beamgogcsfilesystemtest",
+                               Name:       "stub",
+                       },
+                       Content: []byte(""),
+               },
+       })

Review Comment:
   Consider refactoring the creation of the mock storage system into a helper 
function since this block is reused often



##########
sdks/go/pkg/beam/io/filesystem/gcs/gcs_test.go:
##########
@@ -36,3 +40,238 @@ func TestGCS_FilesystemNew(t *testing.T) {
                t.Errorf("c.Close() = %v, want nil", err)
        }
 }
+
+func TestGCS_direct(t *testing.T) {
+       ctx := context.Background()
+       dirPath := "gs://beamgogcsfilesystemtest"
+       filePath := dirPath + "/file.txt"
+
+       server := fakestorage.NewServer([]fakestorage.Object{
+               {
+                       ObjectAttrs: fakestorage.ObjectAttrs{
+                               BucketName: "beamgogcsfilesystemtest",
+                               Name:       "stub",
+                       },
+                       Content: []byte(""),
+               },
+       })
+       defer server.Stop()

Review Comment:
   Prefer using t.Cleanup() over defer, which lets you put the `server.Stop()` 
call into the helper function. See 
https://google.github.io/styleguide/go/decisions#test-helpers



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to