summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-06-29 13:05:46 -0400
committerMathias Stearn <mathias@10gen.com>2010-06-29 13:11:04 -0400
commitc678e84a943d2ee78ed2e45fb5044b1c5faac165 (patch)
treed597b3d78bbfda67f8d19c4a0850e85c0934a8e0 /jstests
parent951713a508e9898fe1f669165a28844d3db6b9e4 (diff)
downloadmongo-c678e84a943d2ee78ed2e45fb5044b1c5faac165.tar.gz
test for gridfs SERVER-1234
Diffstat (limited to 'jstests')
-rw-r--r--jstests/tool/files1.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/jstests/tool/files1.js b/jstests/tool/files1.js
new file mode 100644
index 00000000000..a73cdc04718
--- /dev/null
+++ b/jstests/tool/files1.js
@@ -0,0 +1,26 @@
+// files1.js
+
+t = new ToolTest( "files1" )
+
+db = t.startDB();
+
+t.runTool( "files" , "-d" , t.baseName , "put" , 'mongod' );
+md5 = md5sumFile('mongod');
+
+file_obj = db.fs.files.findOne()
+md5_stored = file_obj.md5;
+md5_computed = db.runCommand({filemd5: file_obj._id}).md5;
+assert.eq( md5 , md5_stored , "A 1" );
+assert.eq( md5 , md5_computed, "A 2" );
+
+try {
+ listFiles(t.ext);
+} catch (e) {
+ runProgram('mkdir', t.ext);
+}
+
+t.runTool( "files" , "-d" , t.baseName , "get" , 'mongod' , '-l' , t.extFile );
+md5 = md5sumFile(t.extFile);
+assert.eq( md5 , md5_stored , "B" );
+
+t.stop()