mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Removed unreliable upload test
no issue This test failed randomly. It is hard to improve the test without defeating the purpose of the test.
This commit is contained in:
parent
386298310b
commit
52a26a7f80
1 changed files with 0 additions and 26 deletions
|
@ -256,32 +256,6 @@ describe('Images API', function () {
|
||||||
await uploadImageCheck({path: originalFilePath, filename: 'a_o-3.png', contentType: 'image/png', expectedFileName: 'a_o-3.png', expectedOriginalFileName: 'a_o-3_o.png'});
|
await uploadImageCheck({path: originalFilePath, filename: 'a_o-3.png', contentType: 'image/png', expectedFileName: 'a_o-3.png', expectedOriginalFileName: 'a_o-3_o.png'});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can upload multiple images with the same name in parallel', async function () {
|
|
||||||
const originalFilePath = p.join(__dirname, '/../../utils/fixtures/images/ghost-logo.png');
|
|
||||||
const originalFilePath2 = p.join(__dirname, '/../../utils/fixtures/images/ghosticon.jpg');
|
|
||||||
|
|
||||||
// Delay the first original file upload by 400ms to force race condition
|
|
||||||
const store = storage.getStorage('images');
|
|
||||||
const saveStub = sinon.stub(store, 'save');
|
|
||||||
let calls = 0;
|
|
||||||
saveStub.callsFake(async function (file) {
|
|
||||||
if (file.name.includes('_o')) {
|
|
||||||
calls += 1;
|
|
||||||
if (calls === 1) {
|
|
||||||
await sleep(400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return saveStub.wrappedMethod.call(this, ...arguments);
|
|
||||||
});
|
|
||||||
const firstPromise = uploadImageCheck({path: originalFilePath, filename: 'a.png', contentType: 'image/png'});
|
|
||||||
await sleep(10);
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
firstPromise,
|
|
||||||
uploadImageCheck({path: originalFilePath2, filename: 'a.png', contentType: 'image/png', expectedFileName: 'a-1.png'})
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Can upload around midnight of month change', async function () {
|
it('Can upload around midnight of month change', async function () {
|
||||||
const clock = sinon.useFakeTimers({now: new Date(2022, 0, 31, 23, 59, 59), shouldAdvanceTime: true});
|
const clock = sinon.useFakeTimers({now: new Date(2022, 0, 31, 23, 59, 59), shouldAdvanceTime: true});
|
||||||
assert.equal(new Date().getMonth(), 0);
|
assert.equal(new Date().getMonth(), 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue