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

Make sure integration tests use most recent API version #2695

Merged
merged 18 commits into from
Sep 27, 2022

Conversation

pcapriotti
Copy link
Contributor

@pcapriotti pcapriotti commented Sep 16, 2022

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@pcapriotti pcapriotti temporarily deployed to cachix September 16, 2022 09:08 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 16, 2022 09:08 Inactive
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Sep 16, 2022
@pcapriotti pcapriotti temporarily deployed to cachix September 16, 2022 10:38 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 16, 2022 10:38 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 19, 2022 08:08 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 19, 2022 08:08 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from 41445d8 to 15d9bd9 Compare September 20, 2022 11:38
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:38 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:38 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from 15d9bd9 to 34d9929 Compare September 20, 2022 11:42
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:42 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:42 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:54 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 20, 2022 11:54 Inactive
@smatting smatting temporarily deployed to cachix September 20, 2022 16:53 Inactive
@smatting smatting temporarily deployed to cachix September 20, 2022 16:53 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 08:25 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 08:25 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 08:40 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 08:40 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 09:28 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 09:28 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from f6b93fa to 08abf85 Compare September 21, 2022 09:43
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 09:43 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 09:43 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from 08abf85 to d6568cc Compare September 21, 2022 11:14
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 11:14 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 21, 2022 11:15 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from d6568cc to 6e22f36 Compare September 21, 2022 13:19
@pcapriotti pcapriotti temporarily deployed to cachix September 26, 2022 11:20 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 26, 2022 11:20 Inactive
@pcapriotti pcapriotti force-pushed the pcapriotti/integration-test-version branch from 068bdd5 to fa7dd56 Compare September 26, 2022 12:13
@pcapriotti pcapriotti temporarily deployed to cachix September 26, 2022 12:13 Inactive
@pcapriotti pcapriotti temporarily deployed to cachix September 26, 2022 12:13 Inactive
@pcapriotti pcapriotti marked this pull request as ready for review September 26, 2022 13:20
@mdimjasevic mdimjasevic self-requested a review September 27, 2022 07:46
Copy link
Contributor

@mdimjasevic mdimjasevic left a comment

Choose a reason for hiding this comment

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

Overall this looks good.

I have concerns with using an unversioned service and then prefixing manually "v1". Also, I found a combination of unversioned + v1 + the v2 suffix.

The Util module in Galley tests has lots of unversioned + v1. Could this be changed to something like apiVersion in other services?

@@ -135,6 +136,38 @@ type Spar = Request -> Request

data FedClient (comp :: Component) = FedClient HTTP.Manager Endpoint

-- | Note: Apply this function last when composing (Request -> Request) functions
apiVersion :: ByteString -> Request -> Request
Copy link
Contributor

Choose a reason for hiding this comment

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

A nit-pick: why not make the first argument a specific version, e.g., V1 instead of a ByteString? When there will be a need to change use sites of apiVersion, we can grep for apiVersion in the project, but I thought it'd be even nicer if we used versions instead of their string representations.

services/galley/test/integration/API.hs Show resolved Hide resolved
Comment on lines +487 to +489
b <- view tsUnversionedBrig
r2 <-
post (b . zUser alice . path "/users/prekeys" . json (missingClients x))
post (b . zUser alice . path "v1/users/prekeys" . json (missingClients x))
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Comment on lines +964 to +967
g <- view tsUnversionedGalley
post $
g
. path "/conversations/list/v2"
. path "/v1/conversations/list/v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Unversioned in addition to being at v1? Is there no function apiVersion in Galley tests? I think it'd be worth it creating a small test package that has utilities like apiVersion instead of copy-pasting it several times.

services/galley/test/integration/API/Util.hs Show resolved Hide resolved
services/galley/test/integration/API/Util.hs Show resolved Hide resolved
services/galley/test/integration/API/Util.hs Show resolved Hide resolved
@pcapriotti
Copy link
Contributor Author

I'll merge for now. We can think about changing apiVersion to take a version value later. It's not that important. As for those unversioned + v1 calls, I hope the confusion is resolved. I prefer it like this, instead of the hackish approach that we were forced to take in brig, because there's no string manipulation involved: the path is cleanly constructed starting from the unversioned one, instead of having to remove the existing prefix first.

@pcapriotti pcapriotti merged commit b130ec6 into develop Sep 27, 2022
@pcapriotti pcapriotti deleted the pcapriotti/integration-test-version branch September 27, 2022 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants