mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Minimize use of jtx::with_only_features (RIPD-1515):
In order to automatically run unit tests with newly created amendments, prefer to start with jtx::supported_features() and then subtract unwanted features. These changes identified a few bugs that were hiding in amendments. One of those bugs, in FlowCross, is not yet fixed. By uncommenting the test in CrossingLimits_test.cpp you can see failures relating to that bug. Since FlowCross is not yet enabled on the network we can fix the bug at our convenience.
This commit is contained in:
@@ -59,7 +59,7 @@ public:
|
||||
void testSignerLists()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Env env(*this);
|
||||
Account const alice {"alice"};
|
||||
env.fund(XRP(1000), alice);
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
void testSignerListsV2()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Env env(*this);
|
||||
Account const alice {"alice"};
|
||||
env.fund(XRP(1000), alice);
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
void testRequireAuthWithDir()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
Env env(*this, with_only_features(featureMultiSign));
|
||||
Env env(*this);
|
||||
Account const alice ("alice");
|
||||
Account const bob ("bob");
|
||||
|
||||
|
||||
@@ -117,10 +117,6 @@ class Feature_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
Env env {*this,
|
||||
with_only_features(featureEscrow, featureCryptoConditions)};
|
||||
// The amendment table has to be modified
|
||||
// since that is what feature RPC actually checks
|
||||
env.app().getAmendmentTable().enable(featureEscrow);
|
||||
env.app().getAmendmentTable().enable(featureCryptoConditions);
|
||||
|
||||
auto jrr = env.rpc("feature") [jss::result];
|
||||
if(! BEAST_EXPECT(jrr.isMember(jss::features)))
|
||||
@@ -221,9 +217,6 @@ class Feature_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
Env env {*this,
|
||||
with_only_features(featureCryptoConditions)};
|
||||
// The amendment table has to be modified
|
||||
// since that is what feature RPC actually checks
|
||||
env.app().getAmendmentTable().enable(featureCryptoConditions);
|
||||
|
||||
auto jrr = env.rpc("feature", "CryptoConditions") [jss::result];
|
||||
if(! BEAST_EXPECTS(jrr[jss::status] == jss::success, "status"))
|
||||
|
||||
@@ -30,11 +30,11 @@ class GatewayBalances_test : public beast::unit_test::suite
|
||||
public:
|
||||
|
||||
void
|
||||
testGWB(std::initializer_list<uint256> fs)
|
||||
testGWB(FeatureBitset features)
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(fs));
|
||||
Env env(*this, features);
|
||||
|
||||
// Gateway account and assets
|
||||
Account const alice {"alice"};
|
||||
@@ -153,9 +153,12 @@ public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testGWB({});
|
||||
testGWB({featureFlow, fix1373});
|
||||
testGWB({featureFlow, fix1373, featureFlowCross});
|
||||
using namespace jtx;
|
||||
testGWB(
|
||||
supported_features_except (featureFlow, fix1373, featureFlowCross));
|
||||
testGWB(
|
||||
supported_features_except ( featureFlowCross));
|
||||
testGWB(supported_amendments());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1941,8 +1941,7 @@ public:
|
||||
cfg->section("transaction_queue")
|
||||
.set("minimum_txn_in_ledger_standalone", "3");
|
||||
return cfg;
|
||||
}),
|
||||
with_features(featureFeeEscalation, fix1513)};
|
||||
})};
|
||||
LoadFeeTrack const& feeTrack = env.app().getFeeTrack();
|
||||
|
||||
{
|
||||
@@ -2254,8 +2253,7 @@ public:
|
||||
// "b" (not in the ledger) is rDg53Haik2475DJx8bjMDSDPj4VX7htaMd.
|
||||
// "c" (phantom signer) is rPcNzota6B8YBokhYtcTNqQVCngtbnWfux.
|
||||
|
||||
test::jtx::Env env(*this,
|
||||
test::jtx::with_only_features(featureMultiSign));
|
||||
test::jtx::Env env(*this);
|
||||
env.fund(test::jtx::XRP(100000), a, ed, g);
|
||||
env.close();
|
||||
|
||||
|
||||
@@ -268,8 +268,8 @@ public:
|
||||
using namespace test::jtx;
|
||||
using namespace std::chrono;
|
||||
Env env { *this, envconfig(validator, ""),
|
||||
with_only_features(featureMultiSign, featureTickets,
|
||||
featureEscrow, featurePayChan) };
|
||||
supported_features_plus(featureTickets) };
|
||||
|
||||
Account const gw { "gateway" };
|
||||
auto const USD = gw["USD"];
|
||||
env.fund(XRP(100000), gw);
|
||||
|
||||
@@ -476,8 +476,7 @@ class LedgerRPC_test : public beast::unit_test::suite
|
||||
cfg->section("transaction_queue")
|
||||
.set("minimum_txn_in_ledger_standalone", "3");
|
||||
return cfg;
|
||||
}),
|
||||
with_features(featureFeeEscalation, fix1513)};
|
||||
})};
|
||||
|
||||
Json::Value jv;
|
||||
jv[jss::ledger_index] = "current";
|
||||
|
||||
@@ -67,12 +67,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void testNegativeBalance(std::initializer_list<uint256> fs)
|
||||
void testNegativeBalance(FeatureBitset features)
|
||||
{
|
||||
testcase("Set noripple on a line with negative balance");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(fs));
|
||||
Env env(*this, features);
|
||||
|
||||
auto const gw = Account("gateway");
|
||||
auto const alice = Account("alice");
|
||||
@@ -113,12 +113,12 @@ public:
|
||||
BEAST_EXPECT(!lines[0u].isMember(jss::no_ripple));
|
||||
}
|
||||
|
||||
void testPairwise(std::initializer_list<uint256> fs)
|
||||
void testPairwise(FeatureBitset features)
|
||||
{
|
||||
testcase("pairwise NoRipple");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(fs));
|
||||
Env env(*this, features);
|
||||
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
@@ -150,12 +150,12 @@ public:
|
||||
env(pay(alice, carol, bob["USD"](50)), ter(tecPATH_DRY));
|
||||
}
|
||||
|
||||
void testDefaultRipple(std::initializer_list<uint256> fs)
|
||||
void testDefaultRipple(FeatureBitset features)
|
||||
{
|
||||
testcase("Set default ripple on an account and check new trustlines");
|
||||
|
||||
using namespace jtx;
|
||||
Env env(*this, with_only_features(fs));
|
||||
Env env(*this, features);
|
||||
|
||||
auto const gw = Account("gateway");
|
||||
auto const alice = Account("alice");
|
||||
@@ -212,15 +212,19 @@ public:
|
||||
{
|
||||
testSetAndClear();
|
||||
|
||||
auto withFeatsTests = [this](std::initializer_list<uint256> fs) {
|
||||
testNegativeBalance(fs);
|
||||
testPairwise(fs);
|
||||
testDefaultRipple(fs);
|
||||
auto withFeatsTests = [this](FeatureBitset features) {
|
||||
testNegativeBalance(features);
|
||||
testPairwise(features);
|
||||
testDefaultRipple(features);
|
||||
};
|
||||
withFeatsTests({});
|
||||
withFeatsTests({featureFlow});
|
||||
withFeatsTests({featureFlow, fix1373});
|
||||
withFeatsTests({featureFlow, fix1373, featureFlowCross});
|
||||
using namespace jtx;
|
||||
withFeatsTests(
|
||||
supported_features_except (featureFlow, fix1373, featureFlowCross));
|
||||
withFeatsTests(
|
||||
supported_features_except ( fix1373, featureFlowCross));
|
||||
withFeatsTests(
|
||||
supported_features_except ( featureFlowCross));
|
||||
withFeatsTests(supported_amendments());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user