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

WPB-4262: Fixing tests for inbound federator calls. #3534

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8e96782
Hotfix: Fixing tests for inbound federator calls.
lepsa Aug 24, 2023
cf65282
WPB-4262: Extending federator integration configmap
lepsa Aug 25, 2023
728016b
Hi ci
lepsa Aug 25, 2023
2858a96
Add new config options to /integration.
fisx Aug 28, 2023
c7d2ef8
Fix pr guidelines.
fisx Aug 28, 2023
f78a868
hi ci
fisx Aug 29, 2023
f23daeb
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
fisx Sep 4, 2023
55dcbc2
Remove outdated FUTUREWORKs.
fisx Sep 4, 2023
9444ad4
try something.
fisx Sep 4, 2023
f51e70c
try something better.
fisx Sep 4, 2023
24ff86e
try something more better.
fisx Sep 4, 2023
597f1dd
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
fisx Sep 5, 2023
19aad7b
Fixup
fisx Sep 5, 2023
5500b9e
Revert "Fixup"
fisx Sep 5, 2023
67f452e
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
fisx Sep 8, 2023
01a8793
Fixup.
fisx Sep 8, 2023
1880999
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
fisx Sep 13, 2023
3c4303d
stash
fisx Sep 13, 2023
2316a6c
WPB-4262: Fixing federator tests
lepsa Sep 15, 2023
664d922
Merge remote-tracking branch 'lepsa/WPB-4262' into hotfixing-federati…
lepsa Sep 18, 2023
52d5652
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
lepsa Sep 19, 2023
47ccdf8
Trying another CI change
lepsa Sep 20, 2023
05100c2
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
lepsa Sep 21, 2023
f6ae835
Merge remote-tracking branch 'origin/develop' into hotfixing-federati…
lepsa Sep 25, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ inwardBrigCallViaIngressWithSettings ::
inwardBrigCallViaIngressWithSettings sslCtx requestPath payload =
do
Endpoint ingressHost ingressPort <- nginxIngress . view teTstOpts <$> input
originDomain <- originDomain . view teTstOpts <$> input
originDomain <- (._teTstOpts.backendTwo.originDomain) <$> input @TestEnv
let target = SrvTarget (cs ingressHost) ingressPort
headers = [(originDomainHeaderName, Text.encodeUtf8 originDomain)]
mgr <- liftToCodensity . liftIO $ http2ManagerWithSSLCtx sslCtx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ spec env =
_ <- putHandle brig (userId user) hdl

let expectedProfile = (publicProfile user UserLegalHoldNoConsent) {profileHandle = Just (Handle hdl)}
backendTwoDomain <- toByteString' <$> asks (._teTstOpts.backendTwo.originDomain)
bdy <-
responseJsonError
=<< inwardCall "/federation/brig/get-user-by-handle" (encode hdl)
-- Explicitly make the call from a domain outside of Federator's own domain
=<< inwardCallWithOriginDomain backendTwoDomain "/federation/brig/get-user-by-handle" (encode hdl)
<!! const 200 === statusCode
liftIO $ bdy `shouldBe` expectedProfile

Expand Down Expand Up @@ -126,7 +128,7 @@ spec env =
-- and "IngressSpec".
it "rejectRequestsWithoutClientCertInward" $
runTestFederator env $ do
originDomain <- originDomain <$> view teTstOpts
originDomain <- (.originDomain) <$> view teTstOpts
fisx marked this conversation as resolved.
Show resolved Hide resolved
hdl <- randomHandle
inwardCallWithHeaders
"federation/brig/get-user-by-handle"
Expand Down Expand Up @@ -160,7 +162,7 @@ inwardCall ::
LBS.ByteString ->
m (Response (Maybe LByteString))
inwardCall requestPath payload = do
originDomain :: Text <- originDomain <$> view teTstOpts
originDomain :: Text <- (.originDomain) <$> view teTstOpts
inwardCallWithOriginDomain (toByteString' originDomain) requestPath payload

inwardCallWithOriginDomain ::
Expand Down
10 changes: 8 additions & 2 deletions services/federator/test/integration/Test/Federator/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,18 @@ data IntegrationConfig = IntegrationConfig
cargohold :: Endpoint,
federatorExternal :: Endpoint,
nginxIngress :: Endpoint,
originDomain :: Text
originDomain :: Text,
backendTwo :: BackendTwoConfig
}
deriving (Show, Generic)

deriveFromJSON deriveJSONOptions ''IntegrationConfig
newtype BackendTwoConfig = BackendTwoConfig
{ originDomain :: Text
}
deriving (Show, Generic)

deriveFromJSON deriveJSONOptions ''BackendTwoConfig
deriveFromJSON deriveJSONOptions ''IntegrationConfig
makeLenses ''TestEnv

-- | Call 'mkEnv' with options from config files.
Expand Down
Loading