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

Prepare apollo-testing-support to new MockServer #5934

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

martinbonnin
Copy link
Contributor

Moving MockServer to a separate repo/packageName would make it a breaking change for apollo-testing-support.

Instead, apollo-testing-support is going to keep using the current (soon to be deprecated) MockServer for now. But we don't want to pull that in other parts of the repo.

This PR tries to contain the blast radius of MockServer. It makes most of apollo-testing-support deprecated:

  • all the things like HostFileSystem, Channel.awaitItem(), etc... were meant to be used from our own tests and the plan is to simply remove them.
  • functions that have MockServer could be somewhat useful but there are ways to replace relatively easily.

@martinbonnin martinbonnin requested a review from BoD as a code owner June 3, 2024 19:12
Copy link

netlify bot commented Jun 3, 2024

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit 5f3a5a7
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/665e1588901d4b0008927eb4

Comment on lines +114 to +129
class MockServerTest(val mockServer: MockServer, val apolloClient: ApolloClient, val scope: CoroutineScope)

fun mockServerTest(
clientBuilder: ApolloClient.Builder.() -> Unit = {},
block: suspend MockServerTest.() -> Unit
) = runTest(true) {
MockServer().use { mockServer ->
ApolloClient.Builder()
.serverUrl(mockServer.url())
.apply(clientBuilder)
.build()
.use {apolloClient ->
MockServerTest(mockServer, apolloClient, this).block()
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is duplicated a bunch of times. It's a bit sad but it's very trivial code so it shouldn't be too hard to maintain.

Copy link
Contributor

@BoD BoD left a comment

Choose a reason for hiding this comment

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

👍

@martinbonnin martinbonnin merged commit 9f630e5 into main Jun 4, 2024
9 checks passed
@martinbonnin martinbonnin deleted the rework-apollo-testing-support branch June 4, 2024 10:10
BoD pushed a commit to BoD/apollo-kotlin that referenced this pull request Jul 1, 2024
* Make all of apollo-testing-support deprecated except for QueueTestNetworkTransport and MapTestNetworkTransport

* remove usage of apollo-testing-support symbols that pull MockServer
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.

2 participants