-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EW-1019: TSP Testing #5375
Open
mkreuzkam-cap
wants to merge
47
commits into
main
Choose a base branch
from
EW-1019
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
EW-1019: TSP Testing #5375
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
0ce5351
Add empty line.
mkreuzkam-cap 7bbabe7
log token
mkreuzkam-cap fcd8d6d
Remove pLimit temporarily for testing.
mkreuzkam-cap 49bfdda
Manual batching of data.
mkreuzkam-cap 628d8c3
Merge branch 'main' into EW-1019
mkreuzkam-cap 397dff6
Fix array size.
mkreuzkam-cap e4548fc
Better logging.
mkreuzkam-cap 634049c
Merge branch 'main' into EW-1019
mkreuzkam-cap 0f7acca
Even more logs!
mkreuzkam-cap 1c342a0
Logging of errors.
mkreuzkam-cap a9669a5
Use bulk operations for sync. (Very WIP!!!)
mkreuzkam-cap 3633cc0
EW-1019 Fix Linter warnings
SimoneRadtke-Cap ac863a7
EW-1019 Fix linter warnings
SimoneRadtke-Cap 551f0e6
Use bulk operations for migration.
mkreuzkam-cap 3c805b4
Merge branch 'main' into EW-1019
mkreuzkam-cap 79c6a7c
EW-1019 Add docker compose file to gitignore
SimoneRadtke-Cap 18217e6
fix linter warning
mkreuzkam-cap 643c843
Bulk migration for students.
mkreuzkam-cap 0a38d25
Merge branch 'main' into EW-1019
mkreuzkam-cap a04d22d
Use configService directly and don't read values in constructor.
mkreuzkam-cap c16a7bf
Add batching.
mkreuzkam-cap 92e1b49
Merge branch 'main' into EW-1019
mkreuzkam-cap 7dc774f
remove console log, add comments
mkreuzkam-cap 2587c90
Clean up migration and move into service class.
mkreuzkam-cap 470329c
Clean up loggables.
mkreuzkam-cap 4a163ae
EW.1019 Add saveAll to account-idm-service
SimoneRadtke-Cap 29534a2
adjust config var usage.
mkreuzkam-cap 8d19ebf
adjust tests (wip)
mkreuzkam-cap a34c3a8
Fix findMany test in accoundIdm service.
mkreuzkam-cap 1b0627b
Fix tsp sync strategy test.
mkreuzkam-cap 216dfb0
Merge branch 'main' into EW-1019
mkreuzkam-cap c734169
Add tests for user service and repo.
mkreuzkam-cap 91d5632
Merge branch 'main' into EW-1019
mkreuzkam-cap 54a3d91
EW-1019 Adjust tsp sync service test
SimoneRadtke-Cap a6e97fa
Fix tests which broke for some reason.
mkreuzkam-cap b9edb39
Fix another test which broke for no reason.
mkreuzkam-cap 9f3e9f1
Add tests for accounts.
mkreuzkam-cap e64b935
Fix an oopsie.
mkreuzkam-cap c58364b
EW-1019 Add test
SimoneRadtke-Cap 905685d
Finish tsp sync migration service test.
mkreuzkam-cap b49aedb
Merge branch 'main' into EW-1019
mkreuzkam-cap d534101
Reduce amount of awaits.
mkreuzkam-cap 27c73ea
remove async/await.
mkreuzkam-cap 45c7d41
Remove line.
mkreuzkam-cap b002a07
Update apps/server/src/modules/account/domain/services/account-db.ser…
mkreuzkam-cap c6bd5ec
Add return type.
mkreuzkam-cap a7b728d
fix linter.
mkreuzkam-cap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/server/src/infra/sync/tsp/loggable/tsp-legacy-migration-start.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/server/src/infra/sync/tsp/loggable/tsp-legacy-migration-system-missing.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/server/src/infra/sync/tsp/loggable/tsp-migration-batch-summary.loggable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { TspMigrationBatchSummaryLoggable } from './tsp-migration-batch-summary.loggable'; | ||
|
||
describe(TspMigrationBatchSummaryLoggable.name, () => { | ||
let loggable: TspMigrationBatchSummaryLoggable; | ||
|
||
beforeAll(() => { | ||
loggable = new TspMigrationBatchSummaryLoggable(1, 2, 3, 4, 5); | ||
}); | ||
|
||
describe('when loggable is initialized', () => { | ||
it('should be defined', () => { | ||
expect(loggable).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe('getLogMessage', () => { | ||
it('should return a log message', () => { | ||
expect(loggable.getLogMessage()).toEqual({ | ||
message: `Migrated 2 users and 3 accounts in batch of size 1 (total done: 4, total migrations: 5)`, | ||
data: { | ||
batchSize: 1, | ||
usersUpdated: 2, | ||
accountsUpdated: 3, | ||
totalDone: 4, | ||
totalMigrations: 5, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
apps/server/src/infra/sync/tsp/loggable/tsp-migration-batch-summary.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Loggable, LogMessage } from '@src/core/logger'; | ||
|
||
export class TspMigrationBatchSummaryLoggable implements Loggable { | ||
constructor( | ||
private readonly batchSize: number, | ||
private readonly usersUpdated: number, | ||
private readonly accountsUpdated: number, | ||
private readonly totalDone: number, | ||
private readonly totalMigrations: number | ||
) {} | ||
|
||
public getLogMessage(): LogMessage { | ||
const message: LogMessage = { | ||
message: `Migrated ${this.usersUpdated} users and ${this.accountsUpdated} accounts in batch of size ${this.batchSize} (total done: ${this.totalDone}, total migrations: ${this.totalMigrations})`, | ||
data: { | ||
batchSize: this.batchSize, | ||
usersUpdated: this.usersUpdated, | ||
accountsUpdated: this.accountsUpdated, | ||
totalDone: this.totalDone, | ||
totalMigrations: this.totalMigrations, | ||
}, | ||
}; | ||
|
||
return message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
apps/server/src/infra/sync/tsp/loggable/tsp-migrations-fetched.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Loggable, LogMessage } from '@src/core/logger'; | ||
|
||
export class TspMigrationsFetchedLoggable implements Loggable { | ||
constructor(private readonly tspUserMigrationCount: number) {} | ||
|
||
public getLogMessage(): LogMessage { | ||
const message: LogMessage = { | ||
message: `Fetched ${this.tspUserMigrationCount} users for migration from TSP`, | ||
data: { | ||
tspUserMigrationCount: this.tspUserMigrationCount, | ||
}, | ||
}; | ||
|
||
return message; | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
apps/server/src/infra/sync/tsp/loggable/tsp-students-fetched.loggable.ts
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
apps/server/src/infra/sync/tsp/loggable/tsp-students-migrated.loggable.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
apps/server/src/infra/sync/tsp/loggable/tsp-students-migrated.loggable.ts
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
apps/server/src/infra/sync/tsp/loggable/tsp-teachers-fetched.loggable.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
apps/server/src/infra/sync/tsp/loggable/tsp-teachers-fetched.loggable.ts
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
apps/server/src/infra/sync/tsp/loggable/tsp-teachers-migrated.loggable.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
apps/server/src/infra/sync/tsp/loggable/tsp-teachers-migrated.loggable.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
apps/server/src/infra/sync/tsp/loggable/tsp-users-migrated.loggable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a separate setup function instead of a simple operation in beforeAll().
in general there should be setup functions in all TSP loggable tests which create the loggable that is tested and the expected result in one go. (See preview-actions.loggable.spec.ts)
This would require less changes in tests whenever the loggable is worked on and separates input and output from the tested function itself.