diff --git a/App/FeatureSet/Workers/DataMigrations/Index.ts b/App/FeatureSet/Workers/DataMigrations/Index.ts index 0f93416d69..10ecf70b7e 100644 --- a/App/FeatureSet/Workers/DataMigrations/Index.ts +++ b/App/FeatureSet/Workers/DataMigrations/Index.ts @@ -23,6 +23,7 @@ import UpdateActiveMonitorCountToBillingProvider from './UpdateActiveMonitorCoun import UpdateGlobalConfigFromEnv from './UpdateGlobalCongfigFromEnv'; import AddTelemetryServiceColor from './AddTelemetryServiceColor'; import MoveGreenlockCertsToAcmeCerts from './MoveGreenlockCertsToAcmeCerts'; +import GenerateNewCertsForStatusPage from './GenerateNewCertsForStatusPage'; // This is the order in which the migrations will be run. Add new migrations to the end of the array. @@ -51,6 +52,7 @@ const DataMigrations: Array = [ new AddSecretKeyToIncomingRequestMonitor(), new AddTelemetryServiceColor(), new MoveGreenlockCertsToAcmeCerts(), + new GenerateNewCertsForStatusPage(), ]; export default DataMigrations; diff --git a/CommonServer/Tests/Middleware/UserAuthorization.test.ts b/CommonServer/Tests/Middleware/UserAuthorization.test.ts index 609389f9cb..49b52de616 100644 --- a/CommonServer/Tests/Middleware/UserAuthorization.test.ts +++ b/CommonServer/Tests/Middleware/UserAuthorization.test.ts @@ -396,7 +396,12 @@ describe('UserMiddleware', () => { ); expect( spyGetUserTenantAccessPermissionWithTenantId - ).toHaveBeenCalledWith(req, projectId, userId); + ).toHaveBeenCalledWith({ + req, + tenantId: projectId, + userId, + isGlobalLogin: true, + }); expect(next).not.toBeCalled(); }); @@ -424,7 +429,12 @@ describe('UserMiddleware', () => { expect( spyGetUserTenantAccessPermissionWithTenantId - ).toHaveBeenCalledWith(req, projectId, userId); + ).toHaveBeenCalledWith({ + req, + tenantId: projectId, + userId, + isGlobalLogin: true, + }); }); test("should not call getUserTenantAccessPermissionForMultiTenant, when is-multi-tenant-query is set in the request header and but userGlobalAccessPermission's projectIds length is zero", async () => { @@ -548,7 +558,12 @@ describe('UserMiddleware', () => { expect( spyGetUserTenantAccessPermissionWithTenantId - ).toHaveBeenCalledWith(mockedRequest, projectId, userId); + ).toHaveBeenCalledWith({ + req: mockedRequest, + tenantId: projectId, + userId, + isGlobalLogin: true, + }); }); }); diff --git a/CommonServer/Tests/Services/TeamMemberService.test.ts b/CommonServer/Tests/Services/TeamMemberService.test.ts index ac7d8b77e5..628eb16d38 100644 --- a/CommonServer/Tests/Services/TeamMemberService.test.ts +++ b/CommonServer/Tests/Services/TeamMemberService.test.ts @@ -25,6 +25,7 @@ import UserNotificationRuleService from '../../Services/UserNotificationRuleServ import Errors from '../../Utils/Errors'; import CreateBy from '../../Types/Database/CreateBy'; +import { Host, HttpProtocol } from '../../EnvironmentConfig'; jest.setTimeout(60000); // Increase test timeout to 60 seconds becuase GitHub runners are slow @@ -210,14 +211,14 @@ describe('TeamMemberService', () => { templateType: 'InviteMember.hbs', toEmail: new Email(nonExistingUserEmail), vars: { - homeUrl: 'http://localhost/', + homeUrl: `${HttpProtocol}${Host}`, isNewUser: 'true', projectName: project.name, - registerLink: `http://localhost/accounts/register?email=${nonExistingUserEmail.replace( + registerLink: `${HttpProtocol}${Host}/accounts/register?email=${nonExistingUserEmail.replace( '@', '%40' )}`, - signInLink: 'http://localhost/accounts', + signInLink: '${HttpProtocol}${Host}/accounts', }, }, { diff --git a/CommonServer/Tests/Utils/AnalyticsDatabase/StatementGenerator.test.ts b/CommonServer/Tests/Utils/AnalyticsDatabase/StatementGenerator.test.ts index 1e40858fae..00915bc045 100644 --- a/CommonServer/Tests/Utils/AnalyticsDatabase/StatementGenerator.test.ts +++ b/CommonServer/Tests/Utils/AnalyticsDatabase/StatementGenerator.test.ts @@ -280,7 +280,7 @@ describe('StatementGenerator', () => { /* eslint-disable prettier/prettier */ expectStatement(statement, SQL` column_1 String NOT NULL, - column_2 Nested ( + column_2 Nested NULL ( nested_column_1 String NOT NULL, nested_column_2 Int32 NULL ) diff --git a/CommonServer/Utils/StartServer.ts b/CommonServer/Utils/StartServer.ts index 94be23c158..46e86f8ec9 100644 --- a/CommonServer/Utils/StartServer.ts +++ b/CommonServer/Utils/StartServer.ts @@ -206,7 +206,7 @@ const addDefaultRoutes: PromiseVoidFunction = async (): Promise => { return Response.sendErrorResponse( req, res, - new NotFoundException('Not found') + new NotFoundException(`Page not found - ${req.url}`) ); }); @@ -214,7 +214,7 @@ const addDefaultRoutes: PromiseVoidFunction = async (): Promise => { return Response.sendErrorResponse( req, res, - new NotFoundException('Not found') + new NotFoundException(`Page not found - ${req.url}`) ); }); @@ -222,7 +222,7 @@ const addDefaultRoutes: PromiseVoidFunction = async (): Promise => { return Response.sendErrorResponse( req, res, - new NotFoundException('Not found') + new NotFoundException(`Page not found - ${req.url}`) ); }); @@ -230,7 +230,7 @@ const addDefaultRoutes: PromiseVoidFunction = async (): Promise => { return Response.sendErrorResponse( req, res, - new NotFoundException('Not found') + new NotFoundException(`Page not found - ${req.url}`) ); }); diff --git a/CommonServer/package.json b/CommonServer/package.json index 9df20e7bdf..f4cd9d12b3 100644 --- a/CommonServer/package.json +++ b/CommonServer/package.json @@ -6,7 +6,7 @@ "scripts": { "compile": "tsc", "clear-modules": "rm -rf node_modules && rm package-lock.json && npm install", - "test": "jest --detectOpenHandles", + "test": "jest --detectOpenHandles --summaryThreshold=1", "coverage": "jest --detectOpenHandles --coverage", "debug:test": "cd .. && export $(grep -v '^#' config.env | xargs) && cd CommonServer && node --inspect node_modules/.bin/jest --runInBand ./Tests --detectOpenHandles", "dep-check": "npm install -g depcheck && depcheck ./ --skip-missing=true" diff --git a/Nginx/Index.ts b/Nginx/Index.ts index a92be1d267..247e160e74 100644 --- a/Nginx/Index.ts +++ b/Nginx/Index.ts @@ -6,7 +6,6 @@ import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabas import AcmeWriteCertificatesJob from './Jobs/AcmeWriteCertificates'; import { PromiseVoidFunction } from 'Common/Types/FunctionTypes'; import InfrastructureStatus from 'CommonServer/Infrastructure/Status'; -import FetchCertificateJobs from './Jobs/FetchCertificates'; const APP_NAME: string = process.env['SERVICE_NAME']; @@ -36,9 +35,6 @@ const init: PromiseVoidFunction = async (): Promise => { PostgresAppInstance.getDatasourceOptions() ); - // init the jobs - FetchCertificateJobs.init(); - AcmeWriteCertificatesJob.init(); // add default routes