X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fplugins.ts;h=3ae99dc2ec182341b783e2da840145a685caa44c;hb=c795e19663a93c24908a7318975f820bac63164f;hp=8aa34fb15e4c4794304ed32d11c0b7d471afd2f4;hpb=fd59208e8ccd796f9ad7e35db82d0c33acfcb92c;p=github%2FChocobozzz%2FPeerTube.git 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 @@ import 'mocha' import * as chai from 'chai' +import { pathExists, remove } from 'fs-extra' +import { join } from 'path' import { testHelloWorldRegisteredSettings } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { HttpStatusCode, PluginType } from '@shared/models' @@ -9,6 +11,7 @@ import { cleanupTests, createSingleServer, killallServers, + makeGetRequest, PeerTubeServer, PluginsCommand, setAccessTokensToServers @@ -349,6 +352,35 @@ describe('Test plugins', function () { await check() }) + it('Should rebuild native modules on Node ABI change', async function () { + await command.install({ path: PluginsCommand.getPluginTestPath('-native') }) + + await makeGetRequest({ + url: server.url, + path: '/plugins/test-native/router', + expectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + + const query = `UPDATE "application" SET "nodeABIVersion" = 1` + await server.sql.updateQuery(query) + + const baseNativeModule = server.servers.buildDirectory(join('plugins', 'node_modules', 'a-native-example')) + await remove(join(baseNativeModule, 'build')) + await remove(join(baseNativeModule, 'prebuilds')) + + await server.kill() + await server.run() + + await pathExists(join(baseNativeModule, 'build')) + await pathExists(join(baseNativeModule, 'prebuilds')) + + await makeGetRequest({ + url: server.url, + path: '/plugins/test-native/router', + expectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + }) + after(async function () { await cleanupTests([ server ]) })