[#1225] Disable deprecated darkside tests
* [#1225] Disable deprecated darkside tests - Closes #1225
This commit is contained in:
parent
c6032b47bd
commit
3721b8b6c4
|
@ -10,11 +10,13 @@ import org.junit.runner.RunWith
|
|||
/**
|
||||
* Integration test to run in order to catch any regressions in transparent behavior.
|
||||
*/
|
||||
// TODO [#1224]: Refactor and re-enable disabled darkside tests
|
||||
// TODO [#1224]: https://github.com/zcash/zcash-android-wallet-sdk/issues/1224
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class TransparentIntegrationTest : DarksideTest() {
|
||||
@Before
|
||||
fun setup() = runOnce {
|
||||
sithLord.await()
|
||||
// sithLord.await()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -6,15 +6,19 @@ import cash.z.ecc.android.sdk.darkside.test.ScopedTest
|
|||
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
// TODO [#1224]: Refactor and re-enable disabled darkside tests
|
||||
// TODO [#1224]: https://github.com/zcash/zcash-android-wallet-sdk/issues/1224
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class InboundTxTests : ScopedTest() {
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testTargetBlock_synced() {
|
||||
validator.validateMinHeightSynced(firstBlock)
|
||||
// validator.validateMinHeightSynced(firstBlock)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -28,10 +32,11 @@ class InboundTxTests : ScopedTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testTxCountAfter() {
|
||||
// add 2 transactions to block 663188 and 'mine' that block
|
||||
addTransactions(targetTxBlock, tx663174, tx663188)
|
||||
sithLord.await(timeout = 30_000L, targetHeight = targetTxBlock)
|
||||
// sithLord.await(timeout = 30_000L, targetHeight = targetTxBlock)
|
||||
validator.validateTxCount(2)
|
||||
}
|
||||
|
||||
|
@ -91,7 +96,7 @@ class InboundTxTests : ScopedTest() {
|
|||
.stageEmptyBlocks(firstBlock + 1, 100)
|
||||
.applyTipHeight(BlockHeight.new(ZcashNetwork.Mainnet, targetTxBlock.value - 1))
|
||||
|
||||
sithLord.await()
|
||||
// sithLord.await()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,34 +3,39 @@ package cash.z.ecc.android.sdk.darkside.reorgs
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import cash.z.ecc.android.sdk.darkside.test.DarksideTestCoordinator
|
||||
import cash.z.ecc.android.sdk.darkside.test.ScopedTest
|
||||
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import org.junit.Before
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
// TODO [#1224]: Refactor and re-enable disabled darkside tests
|
||||
// TODO [#1224]: https://github.com/zcash/zcash-android-wallet-sdk/issues/1224
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ReorgSetupTest : ScopedTest() {
|
||||
|
||||
/*
|
||||
private val birthdayHeight = BlockHeight.new(ZcashNetwork.Mainnet, 663150)
|
||||
private val targetHeight = BlockHeight.new(ZcashNetwork.Mainnet, 663250)
|
||||
*/
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
sithLord.await()
|
||||
// sithLord.await()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testBeforeReorg_minHeight() = timeout(30_000L) {
|
||||
// validate that we are synced, at least to the birthday height
|
||||
validator.validateMinHeightSynced(birthdayHeight)
|
||||
// validator.validateMinHeightSynced(birthdayHeight)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testBeforeReorg_maxHeight() = timeout(30_000L) {
|
||||
// validate that we are not synced beyond the target height
|
||||
validator.validateMaxHeightSynced(targetHeight)
|
||||
// validator.validateMaxHeightSynced(targetHeight)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -3,45 +3,49 @@ package cash.z.ecc.android.sdk.darkside.reorgs
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import cash.z.ecc.android.sdk.darkside.test.DarksideTestCoordinator
|
||||
import cash.z.ecc.android.sdk.darkside.test.ScopedTest
|
||||
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ReorgSmallTest : ScopedTest() {
|
||||
|
||||
/*
|
||||
private val targetHeight = BlockHeight.new(
|
||||
ZcashNetwork.Mainnet,
|
||||
663250
|
||||
)
|
||||
private val hashBeforeReorg = "09ec0d5de30d290bc5a2318fbf6a2427a81c7db4790ce0e341a96aeac77108b9"
|
||||
private val hashAfterReorg = "tbd"
|
||||
*/
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
sithLord.await()
|
||||
// sithLord.await()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testBeforeReorg_latestBlockHash() = timeout(30_000L) {
|
||||
validator.validateBlockHash(targetHeight, hashBeforeReorg)
|
||||
// validator.validateBlockHash(targetHeight, hashBeforeReorg)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testAfterReorg_callbackTriggered() = timeout(30_000L) {
|
||||
hadReorg = false
|
||||
// sithLord.triggerSmallReorg()
|
||||
sithLord.await()
|
||||
// sithLord.await()
|
||||
assertTrue(hadReorg)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Temporarily disabled")
|
||||
fun testAfterReorg_latestBlockHash() = timeout(30_000L) {
|
||||
validator.validateBlockHash(targetHeight, hashAfterReorg)
|
||||
// validator.validateBlockHash(targetHeight, hashAfterReorg)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -2,7 +2,6 @@ package cash.z.ecc.android.sdk.darkside.test
|
|||
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import cash.z.ecc.android.sdk.Synchronizer
|
||||
import cash.z.ecc.android.sdk.model.Account
|
||||
import cash.z.ecc.android.sdk.model.BlockHeight
|
||||
import cash.z.ecc.android.sdk.model.Darkside
|
||||
|
@ -13,15 +12,14 @@ import co.electriccoin.lightwallet.client.model.BlockHeightUnsafe
|
|||
import co.electriccoin.lightwallet.client.model.LightWalletEndpoint
|
||||
import io.grpc.StatusRuntimeException
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Assert
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
|
||||
// TODO [#1224]: Refactor and re-enable disabled darkside tests
|
||||
// TODO [#1224]: https://github.com/zcash/zcash-android-wallet-sdk/issues/1224
|
||||
class DarksideTestCoordinator(val wallet: TestWallet) {
|
||||
constructor(
|
||||
alias: String = "DarksideTestCoordinator",
|
||||
|
@ -95,6 +93,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) {
|
|||
* Waits for, at most, the given amount of time for the synchronizer to download and scan blocks
|
||||
* and reach a 'SYNCED' status.
|
||||
*/
|
||||
/*
|
||||
fun await(timeout: Long = 60_000L, targetHeight: BlockHeight? = null) = runBlocking {
|
||||
ScopedTest.timeoutWith(this, timeout) {
|
||||
synchronizer.status.map { status ->
|
||||
|
@ -110,6 +109,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) {
|
|||
}.filter { it == Synchronizer.Status.SYNCED }.first()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// /**
|
||||
// * Send a transaction and wait until it has been fully created and successfully submitted, which
|
||||
|
@ -135,13 +135,6 @@ class DarksideTestCoordinator(val wallet: TestWallet) {
|
|||
|
||||
inner class DarksideTestValidator {
|
||||
|
||||
fun validateHasBlock(height: BlockHeight) {
|
||||
runBlocking {
|
||||
assertTrue(synchronizer.findBlockHashAsHex(height) != null)
|
||||
assertTrue(synchronizer.findBlockHash(height)?.size ?: 0 > 0)
|
||||
}
|
||||
}
|
||||
|
||||
fun validateLatestHeight(height: BlockHeight) = runBlocking<Unit> {
|
||||
val info = synchronizer.processorInfo.first()
|
||||
val networkBlockHeight = info.networkBlockHeight
|
||||
|
@ -152,6 +145,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) {
|
|||
)
|
||||
}
|
||||
|
||||
/*
|
||||
fun validateMinHeightSynced(minHeight: BlockHeight) = runBlocking<Unit> {
|
||||
val info = synchronizer.processorInfo.first()
|
||||
val lastSyncedHeight = info.lastSyncedHeight
|
||||
|
@ -177,6 +171,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) {
|
|||
val hash = runBlocking { synchronizer.findBlockHashAsHex(height) }
|
||||
assertEquals(expectedHash, hash)
|
||||
}
|
||||
*/
|
||||
|
||||
fun onReorg(callback: (errorHeight: BlockHeight, rewindHeight: BlockHeight) -> Unit) {
|
||||
synchronizer.onChainErrorHandler = callback
|
||||
|
|
Loading…
Reference in New Issue