rippled
Loading...
Searching...
No Matches
NetworkOPs_test.cpp
1#include <test/jtx.h>
2#include <test/jtx/CaptureLogs.h>
3#include <test/jtx/Env.h>
4
5#include <xrpld/app/misc/HashRouter.h>
6
7namespace ripple {
8namespace test {
9
11{
12public:
13 void
14 run() override
15 {
17 }
18
19 void
21 {
22 // All transactions are already marked as SF_BAD, and we should be able
23 // to handle the case properly without an assertion failure
24 testcase("No valid transactions in batch");
25
26 std::string logs;
27
28 {
29 using namespace jtx;
30 auto const alice = Account{"alice"};
31 Env env{
32 *this,
33 envconfig(),
36 env.memoize(env.master);
37 env.memoize(alice);
38
39 auto const jtx = env.jt(ticket::create(alice, 1), seq(1), fee(10));
40
41 auto transacionId = jtx.stx->getTransactionID();
42 env.app().getHashRouter().setFlags(
43 transacionId, HashRouterFlags::HELD);
44
45 env(jtx, json(jss::Sequence, 1), ter(terNO_ACCOUNT));
46
47 env.app().getHashRouter().setFlags(
48 transacionId, HashRouterFlags::BAD);
49
50 env.close();
51 }
52
53 BEAST_EXPECT(
54 logs.find("No transaction to process!") != std::string::npos);
55 }
56};
57
58BEAST_DEFINE_TESTSUITE(NetworkOPs, app, ripple);
59
60} // namespace test
61} // namespace ripple
A testsuite class.
Definition suite.h:52
testcase_t testcase
Memberspace for declaring test cases.
Definition suite.h:152
Provides server functionality for clients.
Definition NetworkOPs.h:70
void run() override
Runs the suite.
Immutable cryptographic account descriptor.
Definition Account.h:20
A transaction testing environment.
Definition Env.h:102
void memoize(Account const &account)
Associate AccountID with account.
Definition Env.cpp:138
Set the fee on a JTx.
Definition fee.h:18
Inject raw JSON.
Definition jtx_json.h:14
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition ter.h:16
T find(T... args)
T is_same_v
Json::Value create(Account const &account, std::uint32_t count)
Create one of more tickets.
Definition ticket.cpp:12
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition envconfig.h:35
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ terNO_ACCOUNT
Definition TER.h:198
Set the sequence number on a JTx.
Definition seq.h:15