aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-03 15:08:36 +0200
committerChocobozzz <me@florianbigard.com>2022-08-03 15:08:36 +0200
commitc795e19663a93c24908a7318975f820bac63164f (patch)
tree149a303be38eedf5aa5a0ec02938f67c75a267fe /server/tests/api
parentfd59208e8ccd796f9ad7e35db82d0c33acfcb92c (diff)
downloadPeerTube-c795e19663a93c24908a7318975f820bac63164f.tar.gz
PeerTube-c795e19663a93c24908a7318975f820bac63164f.tar.zst
PeerTube-c795e19663a93c24908a7318975f820bac63164f.zip
Automatically rebuild native modules on ABI change
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/plugins.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 8aa34fb15..3ae99dc2e 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -2,6 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { pathExists, remove } from 'fs-extra'
6import { join } from 'path'
5import { testHelloWorldRegisteredSettings } from '@server/tests/shared' 7import { testHelloWorldRegisteredSettings } from '@server/tests/shared'
6import { wait } from '@shared/core-utils' 8import { wait } from '@shared/core-utils'
7import { HttpStatusCode, PluginType } from '@shared/models' 9import { HttpStatusCode, PluginType } from '@shared/models'
@@ -9,6 +11,7 @@ import {
9 cleanupTests, 11 cleanupTests,
10 createSingleServer, 12 createSingleServer,
11 killallServers, 13 killallServers,
14 makeGetRequest,
12 PeerTubeServer, 15 PeerTubeServer,
13 PluginsCommand, 16 PluginsCommand,
14 setAccessTokensToServers 17 setAccessTokensToServers
@@ -349,6 +352,35 @@ describe('Test plugins', function () {
349 await check() 352 await check()
350 }) 353 })
351 354
355 it('Should rebuild native modules on Node ABI change', async function () {
356 await command.install({ path: PluginsCommand.getPluginTestPath('-native') })
357
358 await makeGetRequest({
359 url: server.url,
360 path: '/plugins/test-native/router',
361 expectedStatus: HttpStatusCode.NO_CONTENT_204
362 })
363
364 const query = `UPDATE "application" SET "nodeABIVersion" = 1`
365 await server.sql.updateQuery(query)
366
367 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
371 await server.kill()
372 await server.run()
373
374 await pathExists(join(baseNativeModule, 'build'))
375 await pathExists(join(baseNativeModule, 'prebuilds'))
376
377 await makeGetRequest({
378 url: server.url,
379 path: '/plugins/test-native/router',
380 expectedStatus: HttpStatusCode.NO_CONTENT_204
381 })
382 })
383
352 after(async function () { 384 after(async function () {
353 await cleanupTests([ server ]) 385 await cleanupTests([ server ])
354 }) 386 })