Skip to content

Commit 4c1d574

Browse files
committed
main_test: create empty dir on demand
Can't checkin an empty directory.
1 parent 970dcd0 commit 4c1d574

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package main
66

77
import (
88
"io/ioutil"
9+
"os"
910
"testing"
1011

1112
"github.com/fsouza/fake-gcs-server/fakestorage"
@@ -14,6 +15,20 @@ import (
1415
"github.com/sirupsen/logrus"
1516
)
1617

18+
func TestMain(m *testing.M) {
19+
const emptyBucketDir = "testdata/basic/empty-bucket"
20+
err := os.Mkdir(emptyBucketDir, 0755)
21+
if err != nil {
22+
panic(err)
23+
}
24+
var status int
25+
defer func() {
26+
os.Remove(emptyBucketDir)
27+
os.Exit(status)
28+
}()
29+
status = m.Run()
30+
}
31+
1732
func TestGenerateObjectsFromFiles(t *testing.T) {
1833
t.Parallel()
1934
tests := []struct {

0 commit comments

Comments
 (0)