diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-03 15:16:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-03 15:16:56 +0200 |
commit | 9427890798c0e9b87cf13d39c50bc637f7989c7e (patch) | |
tree | f1284f7ba9e4e4d347257fc1c2731f0bd9a87adc /server/tests/api | |
parent | c795e19663a93c24908a7318975f820bac63164f (diff) | |
download | PeerTube-9427890798c0e9b87cf13d39c50bc637f7989c7e.tar.gz PeerTube-9427890798c0e9b87cf13d39c50bc637f7989c7e.tar.zst PeerTube-9427890798c0e9b87cf13d39c50bc637f7989c7e.zip |
Add more tests for plugin rebuild
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/plugins.ts | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index 3ae99dc2e..15c093758 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts | |||
@@ -353,6 +353,13 @@ describe('Test plugins', function () { | |||
353 | }) | 353 | }) |
354 | 354 | ||
355 | it('Should rebuild native modules on Node ABI change', async function () { | 355 | it('Should rebuild native modules on Node ABI change', async function () { |
356 | this.timeout(50000) | ||
357 | |||
358 | const removeNativeModule = async () => { | ||
359 | await remove(join(baseNativeModule, 'build')) | ||
360 | await remove(join(baseNativeModule, 'prebuilds')) | ||
361 | } | ||
362 | |||
356 | await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) | 363 | await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) |
357 | 364 | ||
358 | await makeGetRequest({ | 365 | await makeGetRequest({ |
@@ -365,20 +372,33 @@ describe('Test plugins', function () { | |||
365 | await server.sql.updateQuery(query) | 372 | await server.sql.updateQuery(query) |
366 | 373 | ||
367 | const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) | 374 | const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) |
368 | await remove(join(baseNativeModule, 'build')) | ||
369 | await remove(join(baseNativeModule, 'prebuilds')) | ||
370 | 375 | ||
376 | await removeNativeModule() | ||
371 | await server.kill() | 377 | await server.kill() |
372 | await server.run() | 378 | await server.run() |
373 | 379 | ||
374 | await pathExists(join(baseNativeModule, 'build')) | 380 | expect(await pathExists(join(baseNativeModule, 'build'))).to.be.true |
375 | await pathExists(join(baseNativeModule, 'prebuilds')) | 381 | expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.true |
376 | 382 | ||
377 | await makeGetRequest({ | 383 | await makeGetRequest({ |
378 | url: server.url, | 384 | url: server.url, |
379 | path: '/plugins/test-native/router', | 385 | path: '/plugins/test-native/router', |
380 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | 386 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
381 | }) | 387 | }) |
388 | |||
389 | await removeNativeModule() | ||
390 | |||
391 | await server.kill() | ||
392 | await server.run() | ||
393 | |||
394 | expect(await pathExists(join(baseNativeModule, 'build'))).to.be.false | ||
395 | expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.false | ||
396 | |||
397 | await makeGetRequest({ | ||
398 | url: server.url, | ||
399 | path: '/plugins/test-native/router', | ||
400 | expectedStatus: HttpStatusCode.NOT_FOUND_404 | ||
401 | }) | ||
382 | }) | 402 | }) |
383 | 403 | ||
384 | after(async function () { | 404 | after(async function () { |