Skip to content

Commit 5cd4de7

Browse files
committed
uberf-12323: fix tests
Signed-off-by: Alexey Zinoviev <[email protected]>
1 parent 2efa45f commit 5cd4de7

File tree

10 files changed

+31
-10
lines changed

10 files changed

+31
-10
lines changed

dev/docker-compose.min.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ services:
143143
- STORAGE_CONFIG=${STORAGE_CONFIG}
144144
- MODEL_ENABLED=*
145145
- ACCOUNTS_URL=http://huly.local:3000
146+
- ACCOUNTS_DB_URL=${DB_CR_URL}
146147
- BRANDING_PATH=/var/cfg/branding.json
147148
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
148149
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}

dev/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ services:
195195
- STATS_URL=http://huly.local:4900
196196
- STORAGE_CONFIG=${STORAGE_CONFIG}
197197
- ACCOUNTS_URL=http://huly.local:3000
198+
- ACCOUNTS_DB_URL=${DB_CR_URL}
198199
- BRANDING_PATH=/var/cfg/branding.json
199200
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
200201
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}

qms-tests/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ services:
122122
- TRANSACTOR_URL=ws://transactor:3334;ws://huly.local:3334
123123
- STORAGE_CONFIG=${STORAGE_CONFIG}
124124
- ACCOUNTS_URL=http://account:3003
125+
- ACCOUNTS_DB_URL=${DB_PG_URL}
125126
- BRANDING_PATH=/var/cfg/branding.json
126127
restart: unless-stopped
127128
front:

server/backup-service/src/config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import { type BackupConfig } from '@hcengineering/server-backup'
1717

1818
interface Config extends Omit<BackupConfig, 'Token'> {
1919
AccountsURL: string
20-
AccountsNS: string
20+
AccountsDbURL: string
21+
AccountsDbNS: string
2122
ServiceID: string
2223
Secret: string
2324

@@ -37,7 +38,8 @@ interface Config extends Omit<BackupConfig, 'Token'> {
3738

3839
const envMap: { [key in keyof Config]: string } = {
3940
AccountsURL: 'ACCOUNTS_URL',
40-
AccountsNS: 'ACCOUNTS_NS',
41+
AccountsDbURL: 'ACCOUNTS_DB_URL',
42+
AccountsDbNS: 'ACCOUNTS_NS',
4143
ServiceID: 'SERVICE_ID',
4244
Secret: 'SECRET',
4345
BucketName: 'BUCKET_NAME',
@@ -55,6 +57,7 @@ const envMap: { [key in keyof Config]: string } = {
5557

5658
const required: Array<keyof Config> = [
5759
'AccountsURL',
60+
'AccountsDbURL',
5861
'Secret',
5962
'ServiceID',
6063
'BucketName',
@@ -66,7 +69,8 @@ const required: Array<keyof Config> = [
6669
export const config: () => Config = () => {
6770
const params: Partial<Config> = {
6871
AccountsURL: process.env[envMap.AccountsURL],
69-
AccountsNS: process.env[envMap.AccountsNS],
72+
AccountsDbURL: process.env[envMap.AccountsDbURL],
73+
AccountsDbNS: process.env[envMap.AccountsDbNS],
7074
Secret: process.env[envMap.Secret],
7175
BucketName: process.env[envMap.BucketName] ?? 'backups',
7276
ServiceID: process.env[envMap.ServiceID] ?? 'backup-service',

server/backup/src/service.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import { restore } from './restore'
4444

4545
export interface BackupConfig {
4646
AccountsURL: string
47-
AccountsNS?: string
47+
AccountsDbURL: string
48+
AccountsDbNS?: string
4849
Token: string
4950

5051
Interval: number // Timeout in seconds
@@ -322,13 +323,13 @@ class BackupWorker {
322323
if (pipeline === undefined) {
323324
throw new Error('Pipeline is undefined, cannot proceed with backup')
324325
}
325-
const [accountDB, closeAccountDB] = await getAccountDB(this.config.AccountsURL, this.config.AccountsNS)
326+
const [accountDB, closeAccountDB] = await getAccountDB(this.config.AccountsDbURL, this.config.AccountsDbNS)
326327
const result = await ctx.with(
327328
'backup',
328329
{},
329-
(ctx) => {
330+
async (ctx) => {
330331
try {
331-
return backup(ctx, pipeline as Pipeline, wsIds, storage, accountDB, {
332+
return await backup(ctx, pipeline as Pipeline, wsIds, storage, accountDB, {
332333
skipDomains: this.skipDomains,
333334
force: true,
334335
timeout: this.config.Timeout * 1000,

server/workspace-service/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ export function serveWorkspaceAccount (
9595
}
9696
setMetadata(serverClientPlugin.metadata.Endpoint, accountUri)
9797

98+
const accountDbUrl = process.env.ACCOUNTS_DB_URL
99+
if (accountDbUrl === undefined) {
100+
console.log('Please provide account db url')
101+
process.exit(1)
102+
}
103+
98104
const serverSecret = process.env.SERVER_SECRET
99105
if (serverSecret === undefined) {
100106
console.log('Please provide server secret')
@@ -135,7 +141,8 @@ export function serveWorkspaceAccount (
135141
wsOperation,
136142
brandings,
137143
fulltextUrl,
138-
accountUri
144+
accountUri,
145+
accountDbUrl
139146
)
140147

141148
void worker

server/workspace-service/src/service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ export class WorkspaceWorker {
119119
readonly operation: WorkspaceOperation,
120120
readonly brandings: BrandingMap,
121121
readonly fulltextUrl: string | undefined,
122-
readonly accountsUrl: string
122+
readonly accountsUrl: string,
123+
readonly accountsDbUrl: string
123124
) {}
124125

125126
hasAvailableThread (): boolean {
@@ -605,12 +606,13 @@ export class WorkspaceWorker {
605606
workspace,
606607
opt.backup.backupStorage,
607608
{
609+
AccountsURL: this.accountsUrl,
610+
AccountsDbURL: this.accountsDbUrl,
608611
Token: token,
609612
BucketName: opt.backup.bucketName,
610613
CoolDown: 0,
611614
Timeout: 0,
612615
SkipWorkspaces: '',
613-
AccountsURL: '',
614616
Interval: 0,
615617
Parallel: 1,
616618
KeepSnapshots: 7 * 12

tests/docker-compose.override.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
workspace:
1010
environment:
1111
- DB_URL=${DB_PG_URL}
12+
- ACCOUNTS_DB_URL=${DB_PG_URL}
1213
fulltext:
1314
environment:
1415
- DB_URL=${DB_PG_URL}

tests/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ services:
151151
- STORAGE_CONFIG=${STORAGE_CONFIG}
152152
- REGION=
153153
- ACCOUNTS_URL=http://account:3003
154+
- ACCOUNTS_DB_URL=${MONGO_URL}
154155
- BRANDING_PATH=/var/cfg/branding.json
155156
- STATS_URL=http://stats:4901
156157
restart: unless-stopped

ws-tests/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ services:
178178
- STORAGE_CONFIG=${STORAGE_CONFIG}
179179
- REGION=
180180
- ACCOUNTS_URL=http://huly.local:3003
181+
- ACCOUNTS_DB_URL=${DB_EU_URL}
181182
- BRANDING_PATH=/var/cfg/branding.json
182183
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
183184
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}
@@ -202,6 +203,7 @@ services:
202203
- STATS_URL=http://huly.local:4901
203204
- STORAGE_CONFIG=${STORAGE_CONFIG}
204205
- ACCOUNTS_URL=http://huly.local:3003
206+
- ACCOUNTS_DB_URL=${DB_EU_URL}
205207
- BRANDING_PATH=/var/cfg/branding.json
206208
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
207209
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}

0 commit comments

Comments
 (0)