Skip to content

Commit e1b1b37

Browse files
committed
NODE-520 test to reproduce issue, passing
1 parent 2f2067a commit e1b1b37

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/functional/gridfs_tests.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,3 +3042,47 @@ exports['should correctly seek on file where size of file is a multiple of the c
30423042
});
30433043
}
30443044
}
3045+
3046+
/**
3047+
* @ignore
3048+
*/
3049+
exports['should correctly write fake png to gridstore'] = {
3050+
metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
3051+
3052+
// The actual test we wish to run
3053+
test: function(configuration, test) {
3054+
var MongoClient = configuration.require.MongoClient
3055+
, GridStore = configuration.require.GridStore
3056+
, ObjectID = configuration.require.ObjectID
3057+
, fs = require('fs')
3058+
, assert = require('assert');
3059+
3060+
// Connection URL
3061+
var url = 'mongodb://localhost:27017/myproject';
3062+
var id = new ObjectID();
3063+
3064+
// Create a test buffer
3065+
var buffer = new Buffer(200033);
3066+
3067+
// Use connect method to connect to the Server
3068+
MongoClient.connect(configuration.url(), function(err, db) {
3069+
assert.equal(null, err);
3070+
3071+
var gridStore = new GridStore(db, new ObjectID(), 'w', { "content_type": "image/png", "chunk_size": 1024*4 });
3072+
gridStore.open(function(err, gridStore) {
3073+
test.equal(null, err);
3074+
3075+
gridStore.write(buffer, function(err, result) {
3076+
test.equal(null, err);
3077+
3078+
gridStore.close(function(err, result) {
3079+
test.equal(null, err);
3080+
3081+
db.close();
3082+
test.done();
3083+
});
3084+
});
3085+
});
3086+
});
3087+
}
3088+
}

0 commit comments

Comments
 (0)