rippled
Loading...
Searching...
No Matches
NetworkOPs_test.cpp
1// Copyright (c) 2020 Dev Null Productions
2
3#include <test/jtx.h>
4#include <test/jtx/CaptureLogs.h>
5#include <test/jtx/Env.h>
6
7#include <xrpld/app/misc/HashRouter.h>
8
9namespace ripple {
10namespace test {
11
13{
14public:
15 void
16 run() override
17 {
19 }
20
21 void
23 {
24 // All trasactions are already marked as SF_BAD, and we should be able
25 // to handle the case properly without an assertion failure
26 testcase("No valid transactions in batch");
27
28 std::string logs;
29
30 {
31 using namespace jtx;
32 auto const alice = Account{"alice"};
33 Env env{
34 *this,
35 envconfig(),
38 env.memoize(env.master);
39 env.memoize(alice);
40
41 auto const jtx = env.jt(ticket::create(alice, 1), seq(1), fee(10));
42
43 auto transacionId = jtx.stx->getTransactionID();
44 env.app().getHashRouter().setFlags(
45 transacionId, HashRouterFlags::HELD);
46
47 env(jtx, json(jss::Sequence, 1), ter(terNO_ACCOUNT));
48
49 env.app().getHashRouter().setFlags(
50 transacionId, HashRouterFlags::BAD);
51
52 env.close();
53 }
54
55 BEAST_EXPECT(
56 logs.find("No transaction to process!") != std::string::npos);
57 }
58};
59
60BEAST_DEFINE_TESTSUITE(NetworkOPs, app, ripple);
61
62} // namespace test
63} // 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