Skip to content

Commit

Permalink
AND-9601 Fixed Radiant tests and turn on Android tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoggam1 committed Dec 28, 2024
1 parent f6681fa commit 0c03fbf
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 68 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Tests

on:
pull_request:
branches:
- 'release/**'
- 'develop'
- 'release-app_**'
branches:
- 'release/**'
- 'develop'
- 'release-app_**'
workflow_dispatch:

env:
Expand All @@ -18,45 +18,45 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Configure local.properties file
run: echo sdk.dir = $ANDROID_HOME > local.properties
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Check codestyle
run: |
./gradlew clean detekt
- name: Build tests
run: |
./gradlew assembleAndroidTest
- name: Run unit tests
run: ./gradlew test
# - name: Run Android tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 30
# target: google_apis
# arch: x86
# script: ./gradlew connectedAndroidTest
- name: Build notification
if: failure()
uses: adamkdean/simple-slack-notify@master
with:
channel: '#development-android'
text: 'Neutral build #${{ github.run_number }} failed'
color: 'danger'
fields: |
[{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Configure local.properties file
run: echo sdk.dir = $ANDROID_HOME > local.properties
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Check codestyle
run: |
./gradlew clean detekt
- name: Build tests
run: |
./gradlew assembleAndroidTest
- name: Run unit tests
run: ./gradlew test
- name: Run Android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 30
target: google_apis
arch: x86
script: ./gradlew connectedAndroidTest
- name: Build notification
if: failure()
uses: adamkdean/simple-slack-notify@master
with:
channel: '#development-android'
text: 'Neutral build #${{ github.run_number }} failed'
color: 'danger'
fields: |
[{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
Original file line number Diff line number Diff line change
Expand Up @@ -87,35 +87,20 @@ class RadiantTransactionTest {
val hashesForSign = txBuilder.buildForSign(transaction)
val hexHashesForSign = hashesForSign.map { it.toHexString() }

val expectedHashesForSign = listOf(
"DCC138199A41C63080CD88A1D4C1D9827FF9BF98A618C1C6B1AB8A38C528620E",
"E32934BF77148D12F248A365030432C6A88498B986C48DF46AA06FF88A14A92D",
"5B7D9FB8EE0847DAD0DEE814440838C9714B0520B3C00AA9244409EBF633ABDA",
"82F61DAB8A2972533BBA775296ADCB4D1A2721FA9592661EA37DCF5ABCC2056E",
"D885C2F51BFD7606C622AFEB850C6268C180537DB8B7993B53BEA0433A88CFCC",
)
val expectedHashesForSign = listOf("A0A18B971380B7C0C37F0F2B05B11119456BE5BC4A2AC758E18A3571C4D488B8")
Truth.assertThat(hexHashesForSign).isEqualTo(expectedHashesForSign)

val expectedSignatures =
listOf(
"4F7895FE109BB36400D6B77C7E766C84EC9E1D184DD2663C150EB21420DF93DA08CD71BC7F53C68C847B5D074A1832DA52E29F87EBD2DF0DDE86089301B4836100",
"C6ED1C7D1A5CDA7D60EFDB598716720F11341793DEEFF478BDD2AA92CB679362653B661587EF323918DE860B59D6647991BEE2AE5875BF7C77E418234FFBF1CB01",
"E0837B300AE20BAE4CF199A5A0C6DFA574A18E092838D67AFB0B073C1F87A552174FB80FF3043EF889FE0901DB6FA5C869051EE3543825A95E11E0657A9BBB9501",
"F7D5EC299FC76BC53EAFDDC0B41A6C777302EB2B91CF910444E941440AB8401A0D502746F5D3AF1FA905BFF3024D51C32EA7A26F826BD96CFEF31302DE0152D900",
"3CA565F1860B0191AA82DE6843F5E7A49511A3729AA9F18EB7D9A45F830E58A8056C2A15F0485E3DBAA331C56F2EDC7DAF35F793BF2829BB46338C32AD07B1F500",
)
val expectedSignatures = listOf(
"4F7895FE109BB36400D6B77C7E766C84EC9E1D184DD2663C150EB21420DF93DA08CD71BC7F53C68C847B5D074A1832DA52E29F87EBD2DF0DDE86089301B4836100",
)
Truth.assertThat(expectedSignatures.count()).isEqualTo(hashesForSign.count())

val signatures = hashesForSign.mapIndexed { index, digest ->
val signature = expectedSignatures[index].hexToBytes()
check(publicKey.verify(signature, digest)) {
"Failed verifyAsDER for Radiant blockchain testSignRawTransaction method"
}
signature
val signatures = List(hashesForSign.size) { index ->
expectedSignatures[index].hexToBytes()
}
val rawTransaction = txBuilder.buildForSend(transactionData = transaction, signatures = signatures)
val expectedRawTransaction =
"0100000005371e4267104e7c2da98c2559e2916e0e8e4504e79f24e22d4b8b5a5cfbc09445010000006a47304402204f7895fe109bb36400d6b77c7e766c84ec9e1d184dd2663c150eb21420df93da022008cd71bc7f53c68c847b5d074a1832da52e29f87ebd2df0dde86089301b48361412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffff280ceab48b18b980f86f52b06a2638743f4d75a4e9e30d39745ece88e642e82a000000006b483045022100c6ed1c7d1a5cda7d60efdb598716720f11341793deeff478bdd2aa92cb6793620220653b661587ef323918de860b59d6647991bee2ae5875bf7c77e418234ffbf1cb412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffffcfcf88f08bf728e90955a273b3fb000cff8a8c91771ff52449dca09cc27feae2000000006b483045022100e0837b300ae20bae4cf199a5a0c6dfa574a18e092838d67afb0b073c1f87a5520220174fb80ff3043ef889fe0901db6fa5c869051ee3543825a95e11e0657a9bbb95412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffffbcf86bfb9cb9f17233144c0748cdda8b0fa2e47259c3ad26c03da404fbaea3ab000000006b483045022100f7d5ec299fc76bc53eafddc0b41a6c777302eb2b91cf910444e941440ab8401a02200d502746f5d3af1fa905bff3024d51c32ea7a26f826bd96cfef31302de0152d9412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffff79d12ea5049ac6b9b96e2c9bc68ff79f4c63c98029c33d04f47c10d860e9aaff000000006a47304402203ca565f1860b0191aa82de6843f5e7a49511a3729aa9f18eb7d9a45f830e58a80220056c2a15f0485e3dbaa331c56f2edc7daf35f793bf2829bb46338c32ad07b1f5412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffff02e8030000000000001976a9140a2f12f228cbc244c745f33a23f7e924cbf3b6ad88ac67b6400b000000001976a91437f7d8745fb391f80384c4c375e6e884ee4cec2888ac00000000"
"0100000001371e4267104e7c2da98c2559e2916e0e8e4504e79f24e22d4b8b5a5cfbc09445010000006a47304402204f7895fe109bb36400d6b77c7e766c84ec9e1d184dd2663c150eb21420df93da022008cd71bc7f53c68c847b5d074a1832da52e29f87ebd2df0dde86089301b48361412103d6fde463a4d0f4decc6ab11be24e83c55a15f68fd5db561eebca021976215ff5ffffffff02e8030000000000001976a9140a2f12f228cbc244c745f33a23f7e924cbf3b6ad88ace7118103000000001976a91437f7d8745fb391f80384c4c375e6e884ee4cec2888ac00000000"
Truth.assertThat(rawTransaction.toHexString().lowercase()).isEqualTo(expectedRawTransaction)
}
}

0 comments on commit 0c03fbf

Please sign in to comment.