aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/activitypub/refresher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/activitypub/refresher.ts')
-rw-r--r--server/tests/api/activitypub/refresher.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index 4fb22f512..6c48b7ac8 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -1,5 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { SQLCommand } from '@server/tests/shared'
3import { wait } from '@shared/core-utils' 4import { wait } from '@shared/core-utils'
4import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' 5import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
5import { 6import {
@@ -15,6 +16,7 @@ import {
15 16
16describe('Test AP refresher', function () { 17describe('Test AP refresher', function () {
17 let servers: PeerTubeServer[] = [] 18 let servers: PeerTubeServer[] = []
19 let sqlCommandServer2: SQLCommand
18 let videoUUID1: string 20 let videoUUID1: string
19 let videoUUID2: string 21 let videoUUID2: string
20 let videoUUID3: string 22 let videoUUID3: string
@@ -61,6 +63,8 @@ describe('Test AP refresher', function () {
61 } 63 }
62 64
63 await doubleFollow(servers[0], servers[1]) 65 await doubleFollow(servers[0], servers[1])
66
67 sqlCommandServer2 = new SQLCommand(servers[1])
64 }) 68 })
65 69
66 describe('Videos refresher', function () { 70 describe('Videos refresher', function () {
@@ -71,7 +75,7 @@ describe('Test AP refresher', function () {
71 await wait(10000) 75 await wait(10000)
72 76
73 // Change UUID so the remote server returns a 404 77 // Change UUID so the remote server returns a 404
74 await servers[1].sql.setVideoField(videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f') 78 await sqlCommandServer2.setVideoField(videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f')
75 79
76 await servers[0].videos.get({ id: videoUUID1 }) 80 await servers[0].videos.get({ id: videoUUID1 })
77 await servers[0].videos.get({ id: videoUUID2 }) 81 await servers[0].videos.get({ id: videoUUID2 })
@@ -87,7 +91,7 @@ describe('Test AP refresher', function () {
87 91
88 await killallServers([ servers[1] ]) 92 await killallServers([ servers[1] ])
89 93
90 await servers[1].sql.setVideoField(videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e') 94 await sqlCommandServer2.setVideoField(videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e')
91 95
92 // Video will need a refresh 96 // Video will need a refresh
93 await wait(10000) 97 await wait(10000)
@@ -113,7 +117,7 @@ describe('Test AP refresher', function () {
113 117
114 // Change actor name so the remote server returns a 404 118 // Change actor name so the remote server returns a 404
115 const to = servers[1].url + '/accounts/user2' 119 const to = servers[1].url + '/accounts/user2'
116 await servers[1].sql.setActorField(to, 'preferredUsername', 'toto') 120 await sqlCommandServer2.setActorField(to, 'preferredUsername', 'toto')
117 121
118 await command.get({ accountName: 'user1@' + servers[1].host }) 122 await command.get({ accountName: 'user1@' + servers[1].host })
119 await command.get({ accountName: 'user2@' + servers[1].host }) 123 await command.get({ accountName: 'user2@' + servers[1].host })
@@ -133,7 +137,7 @@ describe('Test AP refresher', function () {
133 await wait(10000) 137 await wait(10000)
134 138
135 // Change UUID so the remote server returns a 404 139 // Change UUID so the remote server returns a 404
136 await servers[1].sql.setPlaylistField(playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e') 140 await sqlCommandServer2.setPlaylistField(playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e')
137 141
138 await servers[0].playlists.get({ playlistId: playlistUUID1 }) 142 await servers[0].playlists.get({ playlistId: playlistUUID1 })
139 await servers[0].playlists.get({ playlistId: playlistUUID2 }) 143 await servers[0].playlists.get({ playlistId: playlistUUID2 })
@@ -148,6 +152,8 @@ describe('Test AP refresher', function () {
148 after(async function () { 152 after(async function () {
149 this.timeout(10000) 153 this.timeout(10000)
150 154
155 await sqlCommandServer2.cleanup()
156
151 await cleanupTests(servers) 157 await cleanupTests(servers)
152 }) 158 })
153}) 159})