Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix flaky tests

Chocobozzz56a28cb95eb0
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 09d1db137f..ea11178fba 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -111,7 +111,7 @@ jobs:
) || \
echo "parse-log.js script does not exist, skipping."
- - name: Upload logs
+ - name: Upload logs and database
uses: actions/upload-artifact@v4
if: failure()
with:
diff --git a/packages/server-commands/src/server/servers-command.ts b/packages/server-commands/src/server/servers-command.ts
index fd664c9bfb..f6d3c3d568 100644
--- a/packages/server-commands/src/server/servers-command.ts
+++ b/packages/server-commands/src/server/servers-command.ts
@@ -49,7 +49,7 @@ export class ServersCommand extends AbstractCommand {
if (!isGithubCI()) return
await ensureDir('artifacts')
- const destname = join('artifacts', 'databases', `peertube-${this.server.internalServerNumber}.sql`)
+ const destname = join('artifacts', `peertube-${this.server.internalServerNumber}.sql`)
console.log('Saving database %s.', destname)
exec(`pg_dump peertube_test${this.server.internalServerNumber} > ${destname}`)
diff --git a/packages/tests/src/api/videos/resumable-upload.ts b/packages/tests/src/api/videos/resumable-upload.ts
index cda059efbd..2ac30072d5 100644
--- a/packages/tests/src/api/videos/resumable-upload.ts
+++ b/packages/tests/src/api/videos/resumable-upload.ts
@@ -135,7 +135,6 @@ describe('Test resumable upload', function () {
})
describe('Directory cleaning', function () {
-
it('Should correctly delete files after an upload', async function () {
const uploadId = await prepareUpload()
await sendChunks({ pathUploadId: uploadId })
@@ -171,7 +170,6 @@ describe('Test resumable upload', function () {
})
describe('Resumable upload and chunks', function () {
-
it('Should accept the same amount of chunks', async function () {
const uploadId = await prepareUpload()
await sendChunks({ pathUploadId: uploadId })
@@ -207,7 +205,18 @@ describe('Test resumable upload', function () {
const size = 1000
const contentRangeBuilder = (start: number) => `bytes ${start}-${start + size - 1}/${size}`
- await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentRangeBuilder, contentLength: size })
+
+ try {
+ await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentRangeBuilder, contentLength: size })
+ } catch (err) {
+ await sendChunks({
+ pathUploadId: uploadId,
+ expectedStatus: HttpStatusCode.BAD_REQUEST_400,
+ contentRangeBuilder,
+ contentLength: size
+ })
+ }
+
await checkFileSize(uploadId, 0)
})