summaryrefslogtreecommitdiff
path: root/jstests/tool/files1.js
blob: 9098c4597cc14a6d7cc7db044d51dff50543b422 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// files1.js

t = new ToolTest( "files1" )

db = t.startDB();

filename = 'mongod'
if ( _isWindows() )
    filename += '.exe'

t.runTool( "files" , "-d" , t.baseName , "put" , filename );
md5 = md5sumFile(filename);

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" , filename , '-l' , t.extFile );
md5 = md5sumFile(t.extFile);
assert.eq( md5 , md5_stored , "B" );

t.stop()