Skip to content

Commit

Permalink
Fix race - Upload object after notification has been setup. (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna Srinivas authored and deekoder committed Oct 27, 2017
1 parent 9f61d83 commit ab65422
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/test/functional/functional-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1087,17 +1087,20 @@ describe('functional tests', function() {
notImplemented = true
}
})
client.putObject(bucketName, objectName, 'stringdata', (err) => {
if (err) return done(err)
// It polls every five seconds, so wait for two-ish polls, then end.
setTimeout(() => {
if (notImplemented == false) {
assert.equal(records, 1)
}
poller.stop()
client.removeObject(bucketName, objectName, done)
}, 11 * 1000)
})
setTimeout(() => { // Give it some time for the notification to be setup.
if (notImplemented) return done()
client.putObject(bucketName, objectName, 'stringdata', (err) => {
if (err) return done(err)
setTimeout(() => { // Give it some time to get the notification.
poller.stop()
client.removeObject(bucketName, objectName, err => {
if (err) return done(err)
if (!records) return done(new Error('notification not received'))
done()
})
}, 5 * 1000)
})
}, 3*1000)
})

// This test is very similar to that above, except it does not include
Expand Down

0 comments on commit ab65422

Please sign in to comment.