Skip to content
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

Simplify process spawning in integration tests #3759

Merged
merged 13 commits into from
Dec 8, 2023
1 change: 1 addition & 0 deletions changelog.d/5-internal/integration-proper-cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simplify process spawning of dynamic backends in integration tests
15 changes: 9 additions & 6 deletions integration/test/Testlib/Env.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,26 @@ mkGlobalEnv cfgFile = do
& Cassandra.setContacts intConfig.cassandra.host []
& Cassandra.setPortNumber (fromIntegral intConfig.cassandra.port)
cassClient <- Cassandra.init cassSettings
let resources = backendResources (Map.elems intConfig.dynamicBackends)
resourcePool <-
liftIO $
createBackendResourcePool
(Map.elems intConfig.dynamicBackends)
resources
intConfig.rabbitmq
cassClient
let sm =
Map.fromList $
[ (intConfig.backendOne.originDomain, intConfig.backendOne.beServiceMap),
(intConfig.backendTwo.originDomain, intConfig.backendTwo.beServiceMap)
]
<> [(berDomain resource, resourceServiceMap resource) | resource <- resources]
tempDir <- Codensity $ withSystemTempDirectory "test"
timeOutSeconds <-
liftIO $
fromMaybe 10 . (readMaybe @Int =<<) <$> (lookupEnv "TEST_TIMEOUT_SECONDS")
pure
GlobalEnv
{ gServiceMap =
Map.fromList
[ (intConfig.backendOne.originDomain, intConfig.backendOne.beServiceMap),
(intConfig.backendTwo.originDomain, intConfig.backendTwo.beServiceMap)
],
{ gServiceMap = sm,
gDomain1 = intConfig.backendOne.originDomain,
gDomain2 = intConfig.backendTwo.originDomain,
gDynamicDomains = (.domain) <$> Map.elems intConfig.dynamicBackends,
Expand Down
Loading
Loading