Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class AppUpgradeIntegrationTest
with PostgresAroundEach
with ProcessTestUtil
with SplitwellTestUtil
with WalletTestUtil {
with WalletTestUtil
with WalletTxLogTestUtil {

private val splitwellDarPathV1 =
s"daml/splitwell/.daml/dist/splitwell-base.dar"
Expand Down Expand Up @@ -174,7 +175,7 @@ class AppUpgradeIntegrationTest

val bobTxsBeforeUpgrade =
clue("Check that bob validator can see the tap in the wallet tx history") {
val txs = bobValidatorWalletClient.listTransactions(None, 10)
val txs = withoutDevNetTopups(bobValidatorWalletClient.listTransactions(None, 10))
inside(txs(0)) { case logEntry: BalanceChangeTxLogEntry =>
logEntry.amount shouldBe walletUsdToAmulet(BigDecimal(1_000_001))
}
Expand All @@ -189,7 +190,8 @@ class AppUpgradeIntegrationTest
}

clue("Check that bob still sees the same wallet tx history") {
val txsAfter = bobValidatorWalletClient.listTransactions(None, 10)
val txsAfter =
withoutDevNetTopups(bobValidatorWalletClient.listTransactions(None, 10))
txsAfter should contain allElementsOf bobTxsBeforeUpgrade
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,13 @@ class SvTimeBasedRewardCouponIntegrationTest

clue("The claims appear in the wallet history") {
eventually() {
val txs = sv1WalletClient
.listTransactions(
None,
Limit.MaxPageSize,
)
val txs = withoutDevNetTopups(
sv1WalletClient
.listTransactions(
None,
Limit.MaxPageSize,
)
)
.collect {
case b: TransferTxLogEntry
if b.subtype.value == TransferTransactionSubtype.WalletAutomation.toProto =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ class WalletTransactionHistoryFrontendIntegrationTest
"show notification transactions" in { implicit env =>
onboardWalletUser(aliceWalletClient, aliceValidatorBackend)
val bobUserParty = onboardWalletUser(bobWalletClient, bobValidatorBackend)
val validatorTxLogBefore = aliceValidatorWalletClient.listTransactions(None, 1000)
val validatorTxLogBefore =
withoutDevNetTopups(aliceValidatorWalletClient.listTransactions(None, 1000))

val (offerCid, _) =
actAndCheck(
Expand Down Expand Up @@ -377,7 +378,8 @@ class WalletTransactionHistoryFrontendIntegrationTest
)

// Only Alice should see notification (note that aliceValidator is shared between tests)
val validatorTxLogAfter = aliceValidatorWalletClient.listTransactions(None, 1000)
val validatorTxLogAfter =
withoutDevNetTopups(aliceValidatorWalletClient.listTransactions(None, 1000))
validatorTxLogBefore should be(validatorTxLogAfter)
checkTxHistory(bobWalletClient, Seq.empty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1552,9 +1552,10 @@ class WalletTxLogIntegrationTest
val sv1UserParty = onboardWalletUser(sv1WalletClient, sv1ValidatorBackend)

// Note: SV1 is reused between tests, ignore TxLog entries created by previous tests
val previousEventId = sv1WalletClient
.listTransactions(None, Limit.MaxPageSize)
.headOption
val previousEventId = withoutDevNetTopups(
sv1WalletClient
.listTransactions(None, Limit.MaxPageSize)
).headOption
.map(_.eventId)

val amuletAmount = BigDecimal(42)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.lfdecentralizedtrust.splice.wallet.store.{
BalanceChangeTxLogEntry,
TransferTxLogEntry,
TxLogEntry,
TxLogEntry as walletLogEntry,
}
import org.scalatest.Assertion

Expand Down Expand Up @@ -91,9 +90,14 @@ trait WalletTxLogTestUtil extends TestCommon with WalletTestUtil with TimeTestUt
}
}

def withoutDevNetTopups(txs: Seq[walletLogEntry]): Seq[walletLogEntry] = {
def withoutDevNetTopups(
txs: Seq[TxLogEntry.TransactionHistoryTxLogEntry]
): Seq[TxLogEntry.TransactionHistoryTxLogEntry] = {
@tailrec
def go(txs: List[walletLogEntry], acc: Seq[walletLogEntry]): Seq[walletLogEntry] =
def go(
txs: List[TxLogEntry.TransactionHistoryTxLogEntry],
acc: Seq[TxLogEntry.TransactionHistoryTxLogEntry],
): Seq[TxLogEntry.TransactionHistoryTxLogEntry] =
txs match {
case Nil => acc
case (first: TransferTxLogEntry) :: (second: BalanceChangeTxLogEntry) :: tail =>
Expand All @@ -113,7 +117,10 @@ trait WalletTxLogTestUtil extends TestCommon with WalletTestUtil with TimeTestUt
go(txs.toList, Seq.empty)
}

def withoutNonDevNetTopups(txs: Seq[walletLogEntry]): Seq[walletLogEntry] = {
// prevents flakes from traffic purchases - possible to happen in Validator wallets
def withoutNonDevNetTopups(
txs: Seq[TxLogEntry.TransactionHistoryTxLogEntry]
): Seq[TxLogEntry.TransactionHistoryTxLogEntry] = {
// On non-DevNet like clusters, traffic topups take input amulets that must have been created beforehand.
txs.filterNot {
case transfer: TransferTxLogEntry =>
Expand Down
Loading