Skip to content

Comments

Documentation for Federation Test Cases#2000

Merged
mdimjasevic merged 24 commits intodevelopfrom
sqservices-1128/federation-test-cases
Dec 21, 2021
Merged

Documentation for Federation Test Cases#2000
mdimjasevic merged 24 commits intodevelopfrom
sqservices-1128/federation-test-cases

Conversation

@mdimjasevic
Copy link
Contributor

@mdimjasevic mdimjasevic commented Dec 16, 2021

Documents and provides federation test cases per https://wearezeta.atlassian.net/browse/SQCORE-1198.

@mythsunwind

Copy link
Contributor

@mythsunwind mythsunwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for marking me in the PR. I was able to include the test cases in the current state of this PR into the certification document.

Since all security functions are currently case sensitive please replace @SF.FEDERATION with @SF.Federation.

@fisx fisx changed the title Documentation for Federation Test Cases Documentation for Federation Test Cases [skip ci] Dec 16, 2021
@fisx fisx force-pushed the sqservices-1128/federation-test-cases branch from e48b4e5 to 6dee431 Compare December 16, 2021 16:32
@mdimjasevic mdimjasevic marked this pull request as ready for review December 17, 2021 10:53
Copy link
Contributor

@pcapriotti pcapriotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo typos.

@fisx fisx changed the title Documentation for Federation Test Cases [skip ci] Documentation for Federation Test Cases Dec 17, 2021
Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdimjasevic could you take another look at my changes and see if you think we've covered everything?

if ci is green this is good to merge IMO.

@mdimjasevic
Copy link
Contributor Author

@fisx , sure, I will take a look!

@fisx
Copy link
Contributor

fisx commented Dec 17, 2021

ci passes locally.

@mdimjasevic
Copy link
Contributor Author

mdimjasevic commented Dec 17, 2021

@mdimjasevic could you take another look at my changes and see if you think we've covered everything?

if ci is green this is good to merge IMO.

It looks good to me. I cannot approve via the GitHub interface since I created the PR.

@fisx
Copy link
Contributor

fisx commented Dec 17, 2021

  test/integration/Test/Federator/InwardSpec.hs:89:11: 
  1) Federator.API.Inward shouldRejectMissmatchingOriginDomainInward
       uncaught exception: ErrorCall
       Assertions failed:
        1: 400 =/= 422
        2: Just "discovery-failure" =/= Just "invalid-domain"
       
       Response was:
       
       Response {responseStatus = Status {statusCode = 422, statusMessage = "Unprocessable Entity"}, responseVersion = HTTP/1.1, responseHeaders = [("Transfer-Encoding","chunked"),("Date","Fri, 17 Dec 2021 12:56:10 GMT"),("Server","Warp/3.3.17"),("Content-Type","application/json")], responseBody = Just "{\"code\":422,\"message\":\"srv record not found: _wire-server-federator._tcp.unknown-domain.com\",\"label\":\"invalid-domain\"}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
       CallStack (from HasCallStack):
         error, called at src/Bilge/Assert.hs:89:5 in bilge-0.22.0-KUsLZvxblgw5jARAGrpYx8:Bilge.Assert
         <!!, called at src/Bilge/Assert.hs:107:19 in bilge-0.22.0-KUsLZvxblgw5jARAGrpYx8:Bilge.Assert
         !!!, called at test/integration/Test/Federator/InwardSpec.hs:89:11 in main:Test.Federator.InwardSpec

looks like concourse is running things differently, leading to different errors in this test case. :-(

@mdimjasevic i suppose it's ok for you to post your typo corrections then...

@pcapriotti
Copy link
Contributor

I forgot earlier, but the federation error documentation in swagger (https://github.com/wireapp/wire-server/blob/develop/services/brig/docs/swagger.md) should be updated to reflect any changes to status codes.

@mdimjasevic
Copy link
Contributor Author

I forgot earlier, but the federation error documentation in swagger (https://github.com/wireapp/wire-server/blob/develop/services/brig/docs/swagger.md) should be updated to reflect any changes to status codes.

Thank you for pointing this out! It's been taken care of in a7123fac2e52d524ac0e920060348d60f53bb481.

@mdimjasevic
Copy link
Contributor Author

looks like concourse is running things differently, leading to different errors in this test case. :-(

I updated the test case to use a non-existing domain, which should make it consistent with running the test locally.

@mdimjasevic i suppose it's ok for you to post your typo corrections then...

Done!

@mdimjasevic mdimjasevic force-pushed the sqservices-1128/federation-test-cases branch from 45ff2c4 to 1e528da Compare December 20, 2021 13:16
- **Federation unavailable** (status: 500, label: `federation-not-available`): Federation is configured for this backend, but the local federator cannot be reached. This can be transient, so clients should retry the request.
- **Federation not implemented** (status: 500, label: `federation-not-implemented`): Federated behaviour for a certain endpoint is not yet implemented.
- **Federator discovery failed** (status: 500, label: `discovery-failure`): A DNS error occurred during discovery of a remote backend. This can be transient, so clients should retry the request.
- **Federator discovery failed** (status: 400, label: `discovery-failure`): A DNS error occurred during discovery of a remote backend. This can be transient, so clients should retry the request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum, why isn't this generated? (just wondering, please don't do anything about this in this PR :))

Copy link
Contributor Author

@mdimjasevic mdimjasevic Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to document the federation errors at the beginning of this Swagger document and then any endpoint that can throw a federation error can throw one of these. This is to avoid repeating the lengthy enumeration of federation errors over and over again at every endpoint that can throw it.

-- (This is also tested in unit tests; search for
-- 'validateDomainCertInvalid' and 'testDiscoveryFailure'.)
it "shouldRejectMissmatchingOriginDomainInward" $
runTestFederator env $ pure ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
runTestFederator env $ pure ()
pure ()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not look thoroughly as to why, but just pure () doesn't type-check. I think that's because other it "blocks" in the spec use the runTestFederator env test values, which then GHC infers a type from, which then forces us to have the same type here, but I'd have to look deeper to confirm this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you're almost right: pure () can have the right type, it's an inference problem because both it and pure are polymorphic, and nothing determines any concrete type for m. you could write:

it "..." $ (pure () :: Assertion)

this would be much better if runTestFederator would set up expensive schaffolding (which is what I thought earlier), but since it's just Reader+IO, I would say just leave it as is.

Marko Dimjašević and others added 3 commits December 20, 2021 15:07
-- (This is also tested in unit tests; search for
-- 'validateDomainCertInvalid' and 'testDiscoveryFailure'.)
it "shouldRejectMissmatchingOriginDomainInward" $
runTestFederator env $ pure ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you're almost right: pure () can have the right type, it's an inference problem because both it and pure are polymorphic, and nothing determines any concrete type for m. you could write:

it "..." $ (pure () :: Assertion)

this would be much better if runTestFederator would set up expensive schaffolding (which is what I thought earlier), but since it's just Reader+IO, I would say just leave it as is.

@mdimjasevic mdimjasevic merged commit 04fde5a into develop Dec 21, 2021
@mdimjasevic mdimjasevic deleted the sqservices-1128/federation-test-cases branch December 21, 2021 12:51
@akshaymankar akshaymankar mentioned this pull request Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants