Skip to content

Commit

Permalink
Merge pull request #98 from soramitsu/query_with_reports
Browse files Browse the repository at this point in the history
update queries flow
  • Loading branch information
RamilMus authored Jul 1, 2024
2 parents c4985af + 3765a0d commit b0435df
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/test/java/requests/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import static io.gatling.javaapi.core.CoreDsl.csv;

public class Constants {
public static final String URL_QUERY = "/peer-2/query";
public static final String URL_QUERY = "query";
public static final String URL_STATUS = "/peer-2/status";
public static final String URL_TRANSACTION = "/peer-2/api/transaction";
public static final String URL_TRANSACTION = "api/transaction";
public static final String DEFAULT_DOMAIN = "wonderland";
public static final String ALICE_ACCOUNT = "alice";
public static final String BOB_ACCOUNT = "bob";
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/requests/Queries.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Queries extends Constants {
public static ChainBuilder queryPostFindAllDomains = exec(feed(CSV_FEEDER)).exec(feed(PEERS_FEEDER))
.exec(http("findAllDomains query")
.post(session -> {
return session.getString("peer") + "query";
return session.getString("peer") + URL_QUERY;
})
.body(ByteArrayBody(session -> {
return SignedQuery.Companion.encode(QueryBuilder
Expand All @@ -30,7 +30,7 @@ public class Queries extends Constants {
.exec(
http("findAccountsByDomainId query")
.post(session -> {
return session.getString("peer") + "query";
return session.getString("peer") + URL_QUERY;
}
)
.body(ByteArrayBody(session -> {
Expand All @@ -46,7 +46,7 @@ public class Queries extends Constants {
.exec(
http("findAllAssets query")
.post(session -> {
return session.getString("peer") + "query";
return session.getString("peer") + URL_QUERY;
}
)
.body(ByteArrayBody(session -> {
Expand All @@ -61,7 +61,7 @@ public class Queries extends Constants {
.exec(
http("findAllTransactions query")
.post(session -> {
return session.getString("peer") + "query";
return session.getString("peer") + URL_QUERY;
}
)
.body(ByteArrayBody(session -> {
Expand Down
28 changes: 26 additions & 2 deletions src/test/java/requests/Transactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@

public class Transactions extends Constants {

public static ChainBuilder txPostRegisterDomain = exec(feed(CSV_FEEDER))
public static ChainBuilder txPostRegisterDomain = exec(feed(CSV_FEEDER)).exec(feed(PEERS_FEEDER))
.exec(
http("registerDomain transaction")
.post(Constants.URL_TRANSACTION)
.post(session -> {
return session.getString("peer") + Constants.URL_TRANSACTION;
}
)
.body(ByteArrayBody(session -> {
return SignedTransaction.Companion.encode(
TransactionBuilder.Companion.builder()
Expand All @@ -27,4 +30,25 @@ public class Transactions extends Constants {
)
)
).exec(http("registerDomain status").get(Constants.URL_STATUS).check(status().is(200)));

public static ChainBuilder txPostTransferAsset = exec(feed(CSV_FEEDER)).exec(feed(PEERS_FEEDER))
.exec(
http("registerDomain transaction")
.post(session -> {
return session.getString("peer") + Constants.URL_TRANSACTION;
}
).body(ByteArrayBody(session -> {
return SignedTransaction.Companion.encode(
TransactionBuilder.Companion.builder()
.account(ExtensionsKt.asAccountId(session.getString("anotherDevAccountIdSender")))
.chainId(Constants.CHAIN_ID)
.transferAsset(ExtensionsKt.asAssetId(session.getString("anotherDevAssetIdSender")),
1,
ExtensionsKt.asAccountId(session.getString("anotherDevAccountIdReceiver"))
)
.buildSigned(Constants.ALICE_KEYPAIR));
}
)
)
).exec(http("registerDomain status").get(Constants.URL_STATUS).check(status().is(200)));
}
4 changes: 2 additions & 2 deletions src/test/resources/gatling.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ gatling {
#fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable
#perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable
#warmUpUrl = "https://gatling.io" # The URL to use to warm-up the HTTP stack (blank means disabled)
#pooledConnectionIdleTimeout = 60000 # Timeout in millis for a connection to stay idle in the pool
#requestTimeout = 60000 # Timeout in millis for performing an HTTP request
pooledConnectionIdleTimeout = 120000 # Timeout in millis for a connection to stay idle in the pool
requestTimeout = 120000 # Timeout in millis for performing an HTTP request
#enableHostnameVerification = false # When set to true, enable hostname verification: SSLEngine.setHttpsEndpointIdentificationAlgorithm("HTTPS")
dns {
#queryTimeout = 5000 # Timeout in millis of each DNS query in millis
Expand Down

0 comments on commit b0435df

Please sign in to comment.