feat(bell): add immutable event store [T-015]
This commit is contained in:
@@ -49,6 +49,8 @@ $hadSenseDSN = Test-Path Env:YOVISION_TEST_POSTGRES_DSN
|
||||
$previousSenseDSN = if ($hadSenseDSN) { (Get-Item Env:YOVISION_TEST_POSTGRES_DSN).Value } else { $null }
|
||||
$hadAdminDSN = Test-Path Env:YOVISION_TEST_POSTGRES_ADMIN_DSN
|
||||
$previousAdminDSN = if ($hadAdminDSN) { (Get-Item Env:YOVISION_TEST_POSTGRES_ADMIN_DSN).Value } else { $null }
|
||||
$hadBellDSN = Test-Path Env:YOVISION_TEST_BELL_POSTGRES_DSN
|
||||
$previousBellDSN = if ($hadBellDSN) { (Get-Item Env:YOVISION_TEST_BELL_POSTGRES_DSN).Value } else { $null }
|
||||
|
||||
function Invoke-Checked {
|
||||
param(
|
||||
@@ -87,17 +89,23 @@ try {
|
||||
'008_control_api.sql',
|
||||
'009_privileges_control_api.sql',
|
||||
'010_reconcile_safety.sql',
|
||||
'011_privileges_reconcile_safety.sql'
|
||||
'011_privileges_reconcile_safety.sql',
|
||||
'012_bell_events.sql',
|
||||
'013_privileges_bell_events.sql'
|
||||
)) {
|
||||
Invoke-Checked $psql '-X' '-v' 'ON_ERROR_STOP=1' '-d' $adminDatabaseDSN '-f' (Join-Path $repoRoot "deploy\postgres\$name")
|
||||
}
|
||||
}
|
||||
Invoke-Checked $psql '-X' '-v' 'ON_ERROR_STOP=1' '-d' $adminRootDSN '-c' 'CREATE ROLE yovision_t012_sense LOGIN IN ROLE sense_app'
|
||||
Invoke-Checked $psql '-X' '-v' 'ON_ERROR_STOP=1' '-d' $adminRootDSN '-c' 'CREATE ROLE yovision_t015_bell LOGIN IN ROLE bell_runtime'
|
||||
Invoke-Checked $psql '-X' '-v' 'ON_ERROR_STOP=1' '-d' $adminDatabaseDSN '-f' (Join-Path $repoRoot 'deploy\postgres\tests\assertions.sql')
|
||||
|
||||
$env:YOVISION_TEST_POSTGRES_DSN = $senseDSN
|
||||
$env:YOVISION_TEST_POSTGRES_ADMIN_DSN = $adminDatabaseDSN
|
||||
$bellDSN = "postgres://yovision_t015_bell@127.0.0.1:$port/${databaseName}?sslmode=disable"
|
||||
$env:YOVISION_TEST_BELL_POSTGRES_DSN = $bellDSN
|
||||
Invoke-Checked 'go' '-C' (Join-Path $repoRoot 'Sense') 'test' './internal/store' '-run' '^TestPostgres' '-count=1'
|
||||
Invoke-Checked 'go' '-C' (Join-Path $repoRoot 'Bell') 'test' './internal/store' '-run' '^TestPostgres' '-count=1'
|
||||
}
|
||||
finally {
|
||||
if ($started) {
|
||||
@@ -132,6 +140,12 @@ finally {
|
||||
else {
|
||||
Remove-Item Env:YOVISION_TEST_POSTGRES_ADMIN_DSN -ErrorAction SilentlyContinue
|
||||
}
|
||||
if ($hadBellDSN) {
|
||||
$env:YOVISION_TEST_BELL_POSTGRES_DSN = $previousBellDSN
|
||||
}
|
||||
else {
|
||||
Remove-Item Env:YOVISION_TEST_BELL_POSTGRES_DSN -ErrorAction SilentlyContinue
|
||||
}
|
||||
$after5432 = @(
|
||||
Get-NetTCPConnection -State Listen -LocalPort 5432 -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty OwningProcess -Unique |
|
||||
|
||||
Reference in New Issue
Block a user