Skip to content

Commit

Permalink
Disable tests properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sappenin committed Nov 27, 2024
1 parent 8c4d11d commit 5a919f5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
public abstract class AbstractIT {

public static final Duration POLL_INTERVAL = Durations.ONE_HUNDRED_MILLISECONDS;
public static final Duration AT_MOST_INTERVAL = Duration.of(50, ChronoUnit.SECONDS);
public static final Duration AT_MOST_INTERVAL = Duration.of(5, ChronoUnit.SECONDS);
public static final String SUCCESS_STATUS = TransactionResultCodes.TES_SUCCESS;

protected static XrplEnvironment xrplEnvironment = XrplEnvironment.getNewConfiguredEnvironment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.primitives.UnsignedLong;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.EnabledIf;
import org.xrpl.xrpl4j.client.JsonRpcClientErrorException;
import org.xrpl.xrpl4j.crypto.keys.KeyPair;
import org.xrpl.xrpl4j.crypto.keys.Seed;
Expand All @@ -44,7 +43,6 @@
import org.xrpl.xrpl4j.model.transactions.EscrowCreate;
import org.xrpl.xrpl4j.model.transactions.XrpCurrencyAmount;
import org.xrpl.xrpl4j.tests.environment.LocalRippledEnvironment;
import org.xrpl.xrpl4j.tests.environment.XrplEnvironment;

import java.time.Duration;

Expand All @@ -54,13 +52,19 @@
*
* @see "https://xrpl.org/accountset.html"
*/
@DisabledIf(value = "shouldRun", disabledReason = "AccountDeleteIT only runs with local rippled nodes.")
@EnabledIf(value = "shouldRun", disabledReason = "AccountDeleteIT only runs runs with local rippled nodes.")
class AccountDeleteIT extends AbstractIT {

static boolean shouldRun() {
return System.getProperty("useTestnet") != null ||
System.getProperty("useDevnet") != null ||
System.getProperty("useClioTestnet") != null;
/**
* If any "real" testnet is being used (i.e., the enviornment specified is not a local one) then this test should not
* be run.
*
* @return {@code true} if test/dev/clio networks are the execution environment; {@code false} otherwise.
*/
private static boolean shouldRun() {
return System.getProperty("useTestnet") == null &&
System.getProperty("useDevnet") == null &&
System.getProperty("useClioTestnet") == null;
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -29,6 +29,7 @@
import org.awaitility.Durations;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.condition.EnabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xrpl.xrpl4j.client.JsonRpcClientErrorException;
Expand All @@ -42,14 +43,27 @@
import org.xrpl.xrpl4j.model.client.ledger.LedgerResult;
import org.xrpl.xrpl4j.model.transactions.Address;
import org.xrpl.xrpl4j.model.transactions.Hash256;
import org.xrpl.xrpl4j.tests.environment.ReportingMainnetEnvironment;
import org.xrpl.xrpl4j.tests.environment.XrplEnvironment;

/**
* An Integration Test to validate submission of Account transactions.
*/
@EnabledIf(value = "shouldRun", disabledReason = "AccountTransactionsIT only runs when Clio Testnet is specified.")
public class AccountTransactionsIT {

/**
* This test actually hits the production network, so we ordinarily don't want to run this test on every development
* run or even CI run. Instead, this test only executes in CI, and only when the suite is pointed at Clio. Note that
* Clio is chosen somewhat arbitrarily as the goal is to simply execute this test once per CI run. We could later
* adjust this to only run when the environment is chosen to be Mainnet, but this project doesn't yet support that as
* an Environment.
*
* @return {@code true} if clio network is the target execution environment; {@code false} otherwise.
*/
private static boolean shouldRun() {
return System.getProperty("useClioTestnet") != null;
}

private final Logger logger = LoggerFactory.getLogger(this.getClass());

// an arbitrary address on xrpl mainnet that has a decent amount of transaction history
Expand All @@ -67,8 +81,8 @@ public void listTransactionsDefaultWithPagination() throws JsonRpcClientErrorExc
}

/**
* This test will fail if we hit a Clio node until <a href="https://github.com/XRPLF/clio/pull/687">CLIO-687</a> is deployed
* to mainnet. We expect 748 transactions across all pages of account_tx, however Clio duplicates the last
* This test will fail if we hit a Clio node until <a href="https://github.com/XRPLF/clio/pull/687">CLIO-687</a> is
* deployed to mainnet. We expect 748 transactions across all pages of account_tx, however Clio duplicates the last
* transaction from each page in the next page, which results in more than 748 transactions returned.
*
* @throws JsonRpcClientErrorException If rippled/Clio returns an error or a request fails.
Expand Down

0 comments on commit 5a919f5

Please sign in to comment.