Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 8667530

Browse files
Signing tests (#1571)
* Allow remainder address from state/governor * Add remainder_in_expiration test * Add first signing tests * Make Java tests faster * More tests * Also assert reference index --------- Co-authored-by: Thibault Martinez <thibault@iota.org>
1 parent 0faeb15 commit 8667530

18 files changed

Lines changed: 1800 additions & 538 deletions

File tree

client/bindings/java/lib/native/Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/bindings/java/lib/src/main/java/org/iota/Client.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,12 +929,12 @@ public ProtocolParametersResponse getProtocolParameters() throws ClientException
929929
* @throws NoFundsReceivedFromFaucetException when the faucet didn't fund the address.
930930
*/
931931
public void requestTestFundsFromFaucet(String address) throws ClientException, NoFundsReceivedFromFaucetException {
932-
int maxAttempts = 5;
932+
int maxAttempts = 60;
933933
for(int i = 0; i < maxAttempts; i++) {
934934
if(getBasicOutputIds(new NodeIndexerApi.QueryParams().withParam("address", address)).length == 0) {
935935
utilsApi.requestFundsFromFaucet(TESTNET_FAUCET_URL, address);
936936
try {
937-
Thread.sleep(1000 * 25);
937+
Thread.sleep(1000);
938938
} catch (InterruptedException e) {
939939
e.printStackTrace();
940940
}

client/bindings/java/lib/src/test/java/org/iota/IndexerApiTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.junit.jupiter.api.Disabled;
1616
import org.junit.jupiter.api.Test;
1717

18+
import java.util.LinkedHashMap;
1819
import java.util.Map;
1920

2021
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -47,8 +48,8 @@ public void testGetAliasOutputIds() throws ClientException, InterruptedException
4748

4849
Output aliasOutput = client.buildAliasOutput(params);
4950

50-
client.buildAndPostBlock(s, new BuildBlockOptions().withOutputs(new Output[] { aliasOutput }));
51-
Thread.sleep(1000 * 25);
51+
Map.Entry<BlockId, Block> entry = client.buildAndPostBlock(s, new BuildBlockOptions().withOutputs(new Output[] { aliasOutput }));
52+
client.retryUntilIncluded(entry.getKey(), 2, 15);
5253

5354
for (OutputId outputId : client.getAliasOutputIds(new NodeIndexerApi.QueryParams().withParam("governor", address)))
5455
System.out.println(outputId);
@@ -71,8 +72,8 @@ public void testGetNftOutputIds() throws ClientException, NoFundsReceivedFromFau
7172

7273
Output aliasOutput = client.buildNftOutput(params);
7374

74-
client.buildAndPostBlock(s, new BuildBlockOptions().withOutputs(new Output[] { aliasOutput }));
75-
Thread.sleep(1000 * 25);
75+
Map.Entry<BlockId, Block> entry = client.buildAndPostBlock(s, new BuildBlockOptions().withOutputs(new Output[] { aliasOutput }));
76+
client.retryUntilIncluded(entry.getKey(), 2, 15);
7677

7778
for (OutputId outputId : client.getNftOutputIds(new NodeIndexerApi.QueryParams().withParam("address", address)))
7879
System.out.println(outputId);
@@ -94,7 +95,7 @@ public void testGetFoundryOutputIds() throws ClientException, NoFundsReceivedFro
9495
});
9596

9697
Map.Entry<BlockId, Block> response = client.buildAndPostBlock(s, new BuildBlockOptions().withOutputs(new Output[] { client.buildAliasOutput(p) }));
97-
Thread.sleep(1000 * 25);
98+
client.retryUntilIncluded(response.getKey(), 2, 15);
9899
TransactionId transactionId = client.getTransactionId(new TransactionPayload(response.getValue().toJson().get("payload").getAsJsonObject()));
99100

100101
// Build the Foundry Output
@@ -120,14 +121,14 @@ public void testGetFoundryOutputIds() throws ClientException, NoFundsReceivedFro
120121
}));
121122

122123
// Create the transaction and use the outputs
123-
client.buildAndPostBlock(s, new BuildBlockOptions()
124+
Map.Entry<BlockId, Block> entry = client.buildAndPostBlock(s, new BuildBlockOptions()
124125
.withOutputs(new Output[] {
125126
foundryOutput,
126127
newAliasOutput
127128
})
128129
);
129130

130-
Thread.sleep(1000 * 25);
131+
client.retryUntilIncluded(entry.getKey(), 2, 15);
131132

132133
for (OutputId outputId : client.getFoundryOutputIds(new NodeIndexerApi.QueryParams().withParam("aliasAddress", client.aliasIdToBech32(aliasId, client.getBech32Hrp()))))
133134
System.out.println(outputId);

0 commit comments

Comments
 (0)