Reduce duplication of mock https servers in integration tests.
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the duplicated server helpers in services/brig/test/integration/API/Provider.hs and services/galley/test/integration/API/Teams/LegalHold.hs, then run git grep -Hn runTLS to confirm the remaining instances. Compare the available bilge and wai-utilities locations with the shown withMockIdP variant. Done means a shared implementation replaces the listed helpers and the integration tests still pass.
Written by the indexing model from the issue text.
Description
There are a number of functions that create https servers for integration tests:
- https://github.com/wireapp/wire-server/blob/b266f9aae3ee8bf31ac83413b7e7f37feb8aa488/services/brig/test/integration/API/Provider.hs#L1519-L1531
- https://github.com/wireapp/wire-server/blob/b266f9aae3ee8bf31ac83413b7e7f37feb8aa488/services/galley/test/integration/API/Teams/LegalHold.hs#L805-L825
- ...? (
git grep -Hn runTLSsuggests these are the only ones)
The following variant has more sophisticated error reporting, but it has been introduced in spar and then removed in the same PR, so it's gone from the code for now:
-- | Copied from galley's 'withTestService'
--
-- FUTUREWORK: use 'asyncWithBound' (that requires the test case to run in IO, though, or some
-- 'unliftIO' magic.)
--
-- The https server may take a few miliseconds (or, depending on your test setup, longer)
-- before it is available. To accomodate for this, the test will be run several times if it
-- throws an exception, and only after a few re-tries, the latest exception will be thrown.
withMockIdP
:: (HasCallStack)
=> (Chan e -> Application) -- ^ the mock service
-> (Chan e -> TestSpar a) -- ^ the test
-> TestSpar a
withMockIdP createApp go = do
config <- view teMockIdP
let tlss = Warp.tlsSettings (cert config) (privateKey config)
let defs = Warp.defaultSettings { Warp.settingsPort = botPort config }
buf <- liftIO newChan
srv <- liftIO . Async.async $
Warp.runTLS tlss defs $
createApp buf
patiently (reportIfServerDied srv >> go buf) `finally` liftIO (Async.cancel srv)
where
reportIfServerDied :: Async.Async () -> TestSpar ()
reportIfServerDied srv = liftIO (Async.poll srv >>= maybe (pure ()) print)
patiently :: TestSpar a -> TestSpar a
patiently = recovering policy continue . const
where
policy = limitRetries 3 <> exponentialBackoff 100000
continue = [\_ -> Control.Monad.Catch.Handler (\(SomeException _) -> pure True)]
Tasks:
- provide a variant of
withMockIdPfrom some library (bilge? wai-utilities?) - use that implementation instead of the ones listed above.
- Dominant language
- Haskell
- Stars
- 2.8k
- Forks
- 332
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 49
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wireapp/wire-server
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
wireapp/wire-server#5632 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
wireapp/wire-server#5443 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
wireapp/wire-server#5315 · 4 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
Dependency DashboardOpen
Difficulty 5/5 Over a week Newbie friendliness 20/100
wireapp/wire-server#4754 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
wireapp/wire-server#4613 ·
Maintainers usually reply within 2 days
All issues in wireapp/wire-server
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
alunduil/siren-json.hs#264 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
alunduil/network-arbitrary#210 ·
Maintainers usually reply within 1 day
-
console: no way to refresh row data in Browse Rows without a full page reloadPossibly taken @12fahed claimed this today. Openk/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hasura/graphql-engine#10895 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
MorphRule, DataizeRule and ContextualizeRule silently accept unknown YAML keys, unlike rewrite `Rule`Possibly taken @renyamamoto2026-cmyk claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/phino#2107 ·
Maintainers usually reply within 1 day