Skip to content

Commit

Permalink
New: Added test suite support
Browse files Browse the repository at this point in the history
This required an update in mockito which was indirectly impacted by not having mavenCentral() as a repository as mentioned here mockito/mockito#2007 (comment)
  • Loading branch information
Kevin Gorham committed Apr 29, 2021
1 parent 009d69f commit 91a6456
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 14 deletions.
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -47,6 +47,7 @@ apply plugin: 'com.vanniktech.maven.publish'

repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
Expand Down
33 changes: 33 additions & 0 deletions src/androidTest/java/cash/z/ecc/android/sdk/PullRequestSuite.kt
@@ -0,0 +1,33 @@
package cash.z.ecc.android.sdk

import cash.z.ecc.android.sdk.integration.SanityTest
import cash.z.ecc.android.sdk.integration.SmokeTest
import cash.z.ecc.android.sdk.integration.service.ChangeServiceTest
import cash.z.ecc.android.sdk.jni.BranchIdTest
import cash.z.ecc.android.sdk.jni.TransparentTest
import cash.z.ecc.android.sdk.transaction.PersistentTransactionManagerTest
import org.junit.runner.RunWith
import org.junit.runners.Suite

/**
* Suite of tests to run before submitting a pull request.
*
* For now, these are just the tests that are known to be recently updated and that pass. In the
* near future this suite will contain only fast running tests that can be used to quickly validate
* that a PR hasn't broken anything major.
*/
@RunWith(Suite::class)
@Suite.SuiteClasses(
// Fast tests that only run locally and don't require darksidewalletd or lightwalletd
BranchIdTest::class,
TransparentTest::class,
PersistentTransactionManagerTest::class,

// potentially exclude because these are long-running (and hit external srvcs)
SanityTest::class,

// potentially exclude because these hit external services
ChangeServiceTest::class,
SmokeTest::class,
)
class PullRequestSuite
Expand Up @@ -126,7 +126,7 @@ class SanityTest(
TestWallet(TestWallet.Backups.SAMPLE_WALLET, ZcashNetwork.Mainnet),
"zxviews1q0hxkupsqqqqpqzsffgrk2smjuccedua7zswf5e3rgtv3ga9nhvhjug670egshd6me53r5n083s2m9mf4va4z7t39ltd3wr7hawnjcw09eu85q0ammsg0tsgx24p4ma0uvr4p8ltx5laum2slh2whc23ctwlnxme9w4dw92kalwk5u4wyem8dynknvvqvs68ktvm8qh7nx9zg22xfc77acv8hk3qqll9k3x4v2fa26puu2939ea7hy4hh60ywma69xtqhcy4037ne8g2sg8sq",
"031c6355641237643317e2d338f5e8734c57e8aa8ce960ee22283cf2d76bef73be",
1195000
1000000
)
)
}
Expand Down
Expand Up @@ -47,7 +47,7 @@ class SmokeTest {

@Test
fun testSync() = runBlocking<Unit> {
wallet.sync(120_000L)
wallet.sync(300_000L)
}

companion object {
Expand Down
Expand Up @@ -121,7 +121,7 @@ class ChangeServiceTest : ScopedTest() {
}
assertNotNull("Using an invalid host should generate an exception.", caughtException)
assertTrue(
"Exception was of the wrong type.",
"Exception was of the wrong type. Expected ${ChainInfoNotMatching::class.simpleName} but was ${caughtException!!::class.simpleName}",
caughtException is ChainInfoNotMatching
)
(caughtException as ChainInfoNotMatching).propertyNames.let { props ->
Expand Down
15 changes: 8 additions & 7 deletions src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt
Expand Up @@ -44,7 +44,7 @@ class TestWallet(
) : this(
backup.seedPhrase,
network = network,
startHeight = backup.testnetBirthday,
startHeight = if (network == ZcashNetwork.Mainnet) backup.mainnetBirthday else backup.testnetBirthday,
alias = alias
)

Expand Down Expand Up @@ -151,12 +151,13 @@ class TestWallet(
}
}

enum class Backups(val seedPhrase: String, val testnetBirthday: Int) {
DEFAULT("column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip cannon foster soldier shallow refuse lunar parrot banana", 1_355_928),
SAMPLE_WALLET("input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory crumble swallow verb laptop switch trophy inform friend permit purpose", 1_330_190),
DEV_WALLET("still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread", 991645),
ALICE("quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely life cliff spirit admit weekend message recipe trumpet impact kitten", 1_330_190),
BOB("canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label human unit option top calm neutral try vocal arena", 1_330_190),
enum class Backups(val seedPhrase: String, val testnetBirthday: Int, val mainnetBirthday: Int) {
// TODO: get the proper birthday values for these wallets
DEFAULT("column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip cannon foster soldier shallow refuse lunar parrot banana", 1_355_928, 1_000_000),
SAMPLE_WALLET("input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory crumble swallow verb laptop switch trophy inform friend permit purpose", 1_330_190, 1_000_000),
DEV_WALLET("still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread", 1_000_000, 991645),
ALICE("quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely life cliff spirit admit weekend message recipe trumpet impact kitten", 1_330_190, 1_000_000),
BOB("canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label human unit option top calm neutral try vocal arena", 1_330_190, 1_000_000),
;
}
}
12 changes: 8 additions & 4 deletions versions.properties
Expand Up @@ -106,7 +106,7 @@ version.com.google.protobuf..protobuf-gradle-plugin=0.8.16

version.com.nhaarman.mockitokotlin2..mockito-kotlin=2.2.0

version.com.vanniktech..gradle-maven-publish-plugin=0.14.2
version.com.vanniktech..gradle-maven-publish-plugin=0.15.0

version.io.grpc..grpc-android=1.37.0

Expand All @@ -124,8 +124,12 @@ version.kotlin=1.4.32
## # available=1.5.0-M1
## # available=1.5.0-M2
## # available=1.5.0-RC
## # available=1.5.0

version.kotlinx.coroutines=1.4.2
## # available=1.4.3-native-mt
## # available=1.4.3
## # available=1.5.0-RC

version.org.jetbrains.dokka..dokka-gradle-plugin=1.4.32

Expand All @@ -138,10 +142,10 @@ version.org.junit.jupiter..junit-jupiter-engine=5.7.1
version.org.junit.jupiter..junit-jupiter-migrationsupport=5.7.1
## # available=5.8.0-M1

version.org.mockito..mockito-android=3.8.0
version.org.mockito..mockito-android=3.9.0

version.org.mockito..mockito-junit-jupiter=3.8.0
version.org.mockito..mockito-junit-jupiter=3.9.0

version.org.owasp..dependency-check-gradle=6.1.5
version.org.owasp..dependency-check-gradle=6.1.6

version.ru.gildor.coroutines..kotlin-coroutines-okhttp=1.0

0 comments on commit 91a6456

Please sign in to comment.