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

Fix Android tests #6408

Merged
merged 12 commits into from Nov 14, 2020
Merged

Fix Android tests #6408

merged 12 commits into from Nov 14, 2020

Conversation

yschimke
Copy link
Collaborator

@yschimke yschimke commented Nov 8, 2020

  • Junit 5
  • bouncy castle fixes
  • lets encrypt test

@yschimke
Copy link
Collaborator Author

yschimke commented Nov 8, 2020

The bouncy castle dependencies are not a pretty read for our purposes https://bouncycastle.org/latest_releases.html

Two sets of jars with different artifact names and the existing one (jdk15) now includes JDK15 classes that break OkHttp. We now need to use jdk15to18.

bcgit/bc-java#762

@yschimke
Copy link
Collaborator Author

yschimke commented Nov 8, 2020

Damn - https://github.com/mannodermaus/android-junit5/blob/599eb29e996850a7d4023872aaba495c9f8722e8/instrumentation/runner/src/main/kotlin/de/mannodermaus/junit5/Helpers.kt#L14

https://github.com/mannodermaus/android-junit5

Furthermore, because JUnit 5 is built on Java 8 from the ground up, its instrumentation tests will only run on devices running Android 8.0 (API 26) or newer. Older phones will skip the execution of these tests completely, marking them as "ignored".

mannodermaus/android-junit5#228

/**
* Test for new Let's Encrypt Root Certificate.
*/
class LetsEncryptClientTest {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Example code for fixing #6403

# Conflicts:
#	regression-test/src/androidTest/java/okhttp/regression/compare/ApacheHttpClientTest.kt
#	regression-test/src/androidTest/java/okhttp/regression/compare/OkHttpClientTest.kt
@yschimke yschimke marked this pull request as draft November 13, 2020 08:48
""".trimIndent().decodeCertificatePem()

val handshakeCertificates = HandshakeCertificates.Builder()
// TODO reenable in official answers
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Member

Choose a reason for hiding this comment

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

should this be in our samples directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think (awkwardly), we validly want 3:

  • Regression test - test against older versions
  • Android test - test modern version using okhttp-tls etc
  • Sample for other cases and documentation

@yschimke yschimke marked this pull request as ready for review November 14, 2020 06:54
@yschimke yschimke merged commit daac9be into square:master Nov 14, 2020
@yschimke yschimke deleted the androidtests branch January 30, 2021 14:11
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.

None yet

2 participants