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
35 changes: 26 additions & 9 deletions .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ jobs:
- BLOCK
timeout-minutes: 40
env:
BASE_URL: "http://127.0.0.1:8081"
BLOCK_NODE_CHART_VERSION: v0.20.1
CONSENSUS_VERSION: v0.67.0
DEFAULT_DURATION: "3s"
DEFAULT_GRACEFUL_STOP: "1s"
DEFAULT_VUS: 2
HELM_RELEASE_NAME: mirror-1
MIRROR_NODE_VERSION: v0.141.0-rc1
SOLO_CLUSTER_NAME: test
Expand Down Expand Up @@ -152,7 +156,7 @@ jobs:
EOF
fi

solo mirror node add --deployment "${SOLO_DEPLOYMENT}" -f mirror.yaml --cluster-ref kind-"${SOLO_CLUSTER_NAME}" --mirror-node-version "${MIRROR_NODE_VERSION}" --pinger
solo mirror node add --deployment "${SOLO_DEPLOYMENT}" -f mirror.yaml --cluster-ref kind-"${SOLO_CLUSTER_NAME}" --mirror-node-version "${MIRROR_NODE_VERSION}" --pinger --enable-ingress

echo "Solo cluster setup completed successfully!"

Expand Down Expand Up @@ -182,25 +186,38 @@ jobs:
echo "${k6}=${value}" >> $GITHUB_ENV
done

declare -A k6MapRestJava
k6MapRestJava["DEFAULT_TOPIC"]="DEFAULT_TOPIC_WITH_FEE_ID"
k6MapRestJava["PRECOMPILE"]="DEFAULT_ACCOUNT_ID_NFTS_ALLOWANCE_SPENDER"
k6MapRestJava["DEFAULT_ACCOUNT_ID_BOB"]="DEFAULT_ACCOUNT_ID_AIRDROP_RECEIVER"

for key in "${!k6MapRestJava[@]}"; do
k6="${k6MapRestJava[$key]}"
value=$(grep -oP "^${key}=(\K.+)$" "$LOG_FILE" | tail -n 1 || true)
echo "${k6}=${value}" >> $GITHUB_ENV
done

- name: Install k6
if: ${{ matrix.stream-type != 'BLOCK' }}
uses: grafana/setup-k6-action@ffe7d7290dfa715e48c2ccc924d068444c94bde2 # v1

- name: Port forward web3
- name: Run rest-java tests
if: ${{ matrix.stream-type != 'BLOCK' }}
run: |
echo "Port forwarding 8080:80"
kubectl port-forward "service/${HELM_RELEASE_NAME}-web3" -n "${SOLO_NAMESPACE}" 8080:80 &
uses: grafana/run-k6-action@a15e2072ede004e8d46141e33d7f7dad8ad08d9d # v1
env:
DEFAULT_ACCOUNT_ID_NFTS_ALLOWANCE_OWNER: "0.0.1003"
DEFAULT_ACCOUNT_ID_AIRDROP_SENDER: "0.0.1003"
with:
path: |
./tools/k6/src/rest-java/apis.js
debug: false
flags: --quiet

- name: Run k6 web3 tests
if: ${{ matrix.stream-type != 'BLOCK' }}
uses: grafana/run-k6-action@a15e2072ede004e8d46141e33d7f7dad8ad08d9d # v1
env:
AMOUNT: "0000000000000000000000000000000000000000000000000000000000000001"
BASE_URL: "http://127.0.0.1:8080"
DEFAULT_DURATION: "3s"
DEFAULT_GRACEFUL_STOP: "1s"
DEFAULT_VUS: 2
KEY_TYPE: "0000000000000000000000000000000000000000000000000000000000000001"
RUN_COMPLEX_TESTS: "false"
RUN_ESTIMATE_TESTS: "false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ public void validateAddress(final String actualAddress) {
: account.getAccountId().toEvmAddress());
}

protected final <T> void deleteOrLogEntities(Collection<T> ids, Consumer<T> deleteAction) {
// Returns "true" if the entities should be deleted
protected final <T> boolean deleteOrLogEntities(Collection<T> ids, Consumer<T> deleteAction) {
if (acceptanceTestProperties.isSkipEntitiesCleanup()) {
logEntities();
return;
return false;
}

deleteAll(ids, deleteAction);
return true;
}

protected void logEntities() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
// Log the values so that they can be parsed in CI and passed to the k6 tests as input.
System.out.println(accountName + "="
+ accountMap.get(accountName).getAccountId().toEvmAddress());
System.out.println("DEFAULT_ACCOUNT_ID_" + accountName + "="

Check notice on line 96 in test/src/test/java/org/hiero/mirror/test/e2e/acceptance/client/AccountClient.java

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

test/src/test/java/org/hiero/mirror/test/e2e/acceptance/client/AccountClient.java#L96

System.out.println is used
+ accountMap.get(accountName).getAccountId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public TokenClient(
public void clean() {
var admin = sdkClient.getExpandedOperatorAccountId();
log.info("Deleting {} tokens and dissociating {} token relationships", tokenIds.size(), associations.size());
deleteOrLogEntities(tokenIds, tokenId -> delete(admin, tokenId));
deleteAll(associations.keySet(), association -> dissociate(association.accountId, association.tokenId));
var entitiesShouldBeDeleted = deleteOrLogEntities(tokenIds, tokenId -> delete(admin, tokenId));
if (entitiesShouldBeDeleted) {
deleteAll(associations.keySet(), association -> dissociate(association.accountId, association.tokenId));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@
@Override
public void clean() {
log.info("Deleting {} topics", topicIds.size());
deleteAll(topicIds, this::deleteTopic);
deleteOrLogEntities(topicIds, this::deleteTopic);
}

@Override
protected void logEntities() {
for (var topicId : topicIds) {
// Log the values so that they can be parsed in CI and passed to the k6 tests as input.
System.out.println("DEFAULT_TOPIC=" + topicId.num);

Check notice on line 59 in test/src/test/java/org/hiero/mirror/test/e2e/acceptance/client/TopicClient.java

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

test/src/test/java/org/hiero/mirror/test/e2e/acceptance/client/TopicClient.java#L59

System.out.println is used
}
}

public NetworkTransactionResponse createTopic(ExpandedAccountId adminAccount, PublicKey submitKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,18 @@ public void deleteFirstNonFungibleTokenAllowance(
accountClient.deleteAllowanceForNft(reExpandedAccountId, new NftId(tokenId, nftInfo.serialNumber)));
}

@Then("I airdrop {int} token to {account}")
public void airdropToken(int amount, AccountNameEnum accountName) {
// This method is needed only for the k6 tests in CI.
if (!properties.isSkipEntitiesCleanup()) {
return;
}
var receiver = accountClient.getAccount(accountName);
var sender = accountClient.getSdkClient().getExpandedOperatorAccountId();
networkTransactionResponse =
verify(tokenClient.executeFungibleTokenAirdrop(tokenId, sender, receiver.getAccountId(), amount));
}

@Then("I airdrop {int} tokens to {account}")
public void airdropTokens(int amount, AccountNameEnum accountName) {
var receiver = accountClient.getAccount(accountName);
Expand Down
2 changes: 2 additions & 0 deletions test/src/test/resources/features/token/token.feature
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Feature: HTS Base Coverage Feature
Then DAVE claims the airdrop
Then the mirror node REST API should return the transaction and get transaction detail
And I verify "successful" airdrop of <amount> tokens to DAVE
Then I airdrop 1 token to BOB
Then the mirror node REST API should return the transaction

Examples:
| amount | freezeStatus | kycStatus | modifySupplyAmount |
Expand Down
Loading