Skip to content

Stabilize index migration tests #4413

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

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.d/5-internal/refreshIndex-correct-url
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/i/index/refresh now uses the correct URL for additional indices. Thus, the
refreshed indices can reside on different ElasticSearch instances. This
endpoint is exclusively called from tests.
6 changes: 5 additions & 1 deletion services/brig/src/Brig/User/Search/Index.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ refreshIndexes = liftIndexIO $ do
idx <- asks idxName
void $ ES.refreshIndex idx
mbAddIdx <- asks idxAdditionalName
mapM_ ES.refreshIndex mbAddIdx
mbAddElasticEnv <- asks idxAdditionalElastic
case (mbAddIdx, mbAddElasticEnv) of
(Just addIdx, Just addElasticEnv) ->
ES.runBH addElasticEnv ((void . ES.refreshIndex) addIdx)
(_, _) -> pure ()

createIndexIfNotPresent ::
(MonadIndexIO m) =>
Expand Down
6 changes: 5 additions & 1 deletion services/brig/test/integration/API/Search.hs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,11 @@ indexProxyServer idxs opts mgr =
proxyToHost = URI.hostBS . URI.authorityHost . fromMaybe (error "No Host") . URI.uriAuthority $ proxyURI
proxyToPort = URI.portNumber . fromMaybe (URI.Port 9200) . URI.authorityPort . fromMaybe (error "No Host") . URI.uriAuthority $ proxyURI
forwardRequest = Wai.WPRProxyDestSecure (Wai.ProxyDest proxyToHost proxyToPort)
denyRequest req = Wai.WPRResponse (Wai.responseLBS HTTP.status400 [] $ "Refusing to proxy to path=" <> cs (Wai.rawPathInfo req))
denyRequest req =
Wai.WPRResponse
( Wai.responseLBS HTTP.status400 [] $
"Refusing to proxy to path=" <> cs (Wai.rawPathInfo req) <> ". Proxy configured for indices: " <> cs (show idxs)
)
proxyApp req
| (headMay (Wai.pathInfo req)) `elem` [Just "_reindex", Just "_tasks"] =
forwardRequest
Expand Down
Loading