diff options
author | alabid <alabidan@gmail.com> | 2014-09-26 22:46:40 -0400 |
---|---|---|
committer | alabid <alabidan@gmail.com> | 2014-09-26 22:46:40 -0400 |
commit | 24d4c8adeb075ac9afcbbcf65f1ccb21d8e45178 (patch) | |
tree | 79a9aa9438874bddbeb7392e8cce92aab03adcf4 /src | |
parent | a03cc89a9ba73663fa6297b4a78175bf3a90aefb (diff) | |
download | mongo-24d4c8adeb075ac9afcbbcf65f1ccb21d8e45178.tar.gz |
check that file copied (during test) to local FS actually exists
Former-commit-id: e62ffbc20c124135390a30f8a0a5551a196cadea
Diffstat (limited to 'src')
-rw-r--r-- | src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go b/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go index 80e4639a758..018cadb0b36 100644 --- a/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go +++ b/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go @@ -612,6 +612,29 @@ func TestMongoFilesCommands(t *testing.T) { }) }) + Convey("Testing the 'get' command with a file that is in GridFS should", func() { + args := []string{"get", "samplefile1.txt"} + + mf, err := shimMongoFilesInstance(args) + + So(err, ShouldBeNil) + So(mf, ShouldNotBeNil) + + Convey("copy the file to the local filesystem", func() { + str, err := mf.Run(false) + So(err, ShouldBeNil) + So(len(str), ShouldNotEqual, 0) + + // check that 'samplefile1.txt' now exists on local filesystem + So(fileExists("samplefile1.txt"), ShouldBeTrue) + + Reset(func() { + err = os.Remove("samplefile1.txt") + So(err, ShouldBeNil) + }) + }) + }) + Reset(func() { So(tearDownGridFSTestShimData(), ShouldBeNil) }) |