Skip to content

Commit

Permalink
Freshen stale tests
Browse files Browse the repository at this point in the history
  • Loading branch information
who-biz committed Dec 15, 2018
1 parent ab9ebfd commit fd6f01b
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 78 deletions.
1 change: 0 additions & 1 deletion tests/functional_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ target_link_libraries(functional_tests
set_property(TARGET functional_tests
PROPERTY
FOLDER "tests")

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const uint64_t AMOUNT_1XMR = 1000000000000L;

const std::string PAYMENT_ID_EMPTY = "";

std::string TESTNET_DAEMON_ADDRESS = "localhost:18566";
std::string MAINNET_DAEMON_ADDRESS = "localhost:14894";
std::string TESTNET_DAEMON_ADDRESS = "localhost:21111";
std::string MAINNET_DAEMON_ADDRESS = "localhost:13894";


}
Expand Down
6 changes: 3 additions & 3 deletions tests/libwallet_api_tests/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

## Environment for the tests
* Running monero node, linked to private/public testnet.
By default, tests expect daemon running at ```localhost:14894```,
By default, tests expect daemon running at ```localhost:13894```,
can be overridden with environment variable ```TESTNET_DAEMON_ADDRESS=<your_daemon_address>```
[Manual](https://github.com/moneroexamples/private-testnet) explaining how to run private testnet.

* Directory with pre-generated wallets
(wallet_01.bin, wallet_02.bin,...,wallet_06.bin, some of these wallets might not be used in the tests currently).
(wallet_01, wallet_02,...,wallet_06, some of these wallets might not be used in the tests currently).
By default, tests expect these wallets to be in ```/var/monero/testnet_pvt```.
Directory can be overriden with environment variable ```WALLETS_ROOT_DIR=<your_directory_with_wallets>```.
Directory and files should be writable for the user running tests.


## Generating test wallets
* ```create_wallets.sh``` - this script will create wallets (wallet_01.bin, wallet_02.bin,...,wallet_06.bin) in current directory.
* ```create_wallets.sh``` - this script will create wallets (wallet_01, wallet_02,...,wallet_06) in current directory.
when running first time, please uncomment line ```#create_wallet wallet_m``` to create miner wallet as well.
This wallet should be used for mining and all test wallets supposed to be seed from this miner wallet

Expand Down
16 changes: 8 additions & 8 deletions tests/libwallet_api_tests/scripts/create_wallets.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
#!/bash

function create_wallet {
wallet_name=$1
echo 0 | monero-wallet-cli --testnet --trusted-daemon --daemon-address localhost:14894 --generate-new-wallet $wallet_name --password "" --restore-height=1
echo 0 | blur-wallet-cli --testnet --daemon-address localhost:13894 --generate-new-wallet $wallet_name --password "" --restore-height=1
}


create_wallet wallet_01.bin
create_wallet wallet_02.bin
create_wallet wallet_03.bin
create_wallet wallet_04.bin
create_wallet wallet_05.bin
create_wallet wallet_06.bin
create_wallet wallet_01
create_wallet wallet_02
create_wallet wallet_03
create_wallet wallet_04
create_wallet wallet_05
create_wallet wallet_06

# create_wallet wallet_m

Expand Down
4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/mining_start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_m --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_m.log start_mining
rlwrap blur-wallet-cli --wallet-file wallet_m --password "" --testnet --daemon-address localhost:13894 --log-file wallet_m.log start_mining

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/mining_stop.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_m --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_miner.log stop_mining
rlwrap blur-wallet-cli --wallet-file wallet_m --password "" --testnet --daemon-address localhost:14894 --log-file wallet_miner.log stop_mining

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_1.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
#!/bash


rlwrap monero-wallet-cli --wallet-file wallet_01.bin --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_01.log
rlwrap blur-wallet-cli --wallet-file wallet_01 --password "" --testnet --daemon-address localhost:13894 --log-file wallet_01.log

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_2.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
#!/bash


rlwrap monero-wallet-cli --wallet-file wallet_02.bin --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_01.log
rlwrap blur-wallet-cli --wallet-file wallet_02 --password "" --testnet --daemon-address localhost:13894 --log-file wallet_01.log

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_3.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_03.bin --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_03.log
rlwrap blur-wallet-cli --wallet-file wallet_03 --password "" --testnet --daemon-address localhost:13894 --log-file wallet_03.log

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_4.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_04.bin --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_04.log
rlwrap blur-wallet-cli --wallet-file wallet_04 --password "" --testnet --daemon-address localhost:13894 --log-file wallet_04.log

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_5.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_05.bin --password "" --testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_05.log
rlwrap blur-wallet-cli --wallet-file wallet_05 --password "" --testnet --daemon-address localhost:13894 --log-file wallet_05.log

4 changes: 2 additions & 2 deletions tests/libwallet_api_tests/scripts/open_wallet_miner.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bash

rlwrap monero-wallet-cli --wallet-file wallet_m --password "" --testnet --trusted-daemon --daemon-address 127.0.0.1:14894 --log-file wallet_m.log
rlwrap blur-wallet-cli --wallet-file wallet_m --password "" --testnet --daemon-address 127.0.0.1:13894 --log-file wallet_m.log

18 changes: 9 additions & 9 deletions tests/libwallet_api_tests/scripts/send_funds.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/bin/bash
#!/bash

function send_funds {
local amount=$1
local dest=$(cat "$2.address.txt")

monero-wallet-cli --wallet-file wallet_m --password "" \
--testnet --trusted-daemon --daemon-address localhost:14894 --log-file wallet_m.log \
blur-wallet-cli --wallet-file wallet_m --password "" \
--testnet --daemon-address localhost:13894 --log-file wallet_m.log \
--command transfer $dest $amount
}


function seed_wallets {
local amount=$1
send_funds $amount wallet_01.bin
send_funds $amount wallet_02.bin
send_funds $amount wallet_03.bin
send_funds $amount wallet_04.bin
send_funds $amount wallet_05.bin
send_funds $amount wallet_06.bin
send_funds $amount wallet_01
send_funds $amount wallet_02
send_funds $amount wallet_03
send_funds $amount wallet_04
send_funds $amount wallet_05
send_funds $amount wallet_06
}

seed_wallets 1
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/address_from_url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST(AddressFromTXT, Success)

EXPECT_STREQ(addr.c_str(), res.c_str());

std::string txtr3 = "foobar oa1:msr tx_description=\"Donation for BLUR Development Fund\"; ";
std::string txtr3 = "foobar oa1:blur tx_description=\"Donation for Blur Network Development Fund\"; ";
txtr3 += "recipient_address=";
txtr3 += addr;
txtr3 += "; foobar";
Expand All @@ -84,7 +84,7 @@ TEST(AddressFromTXT, Failure)

TEST(AddressFromURL, Success)
{
const std::string addr = HONEYPOT_DONATION_ADDR;
const std::string addr = BLUR_DONATION_ADDR;

bool dnssec_result = false;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/canonical_amounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static const uint64_t valid_decomposed_outputs[] = {
(uint64_t)1000000000, (uint64_t)2000000000, (uint64_t)3000000000, (uint64_t)4000000000, (uint64_t)5000000000, (uint64_t)6000000000, (uint64_t)7000000000, (uint64_t)8000000000, (uint64_t)9000000000,
(uint64_t)10000000000, (uint64_t)20000000000, (uint64_t)30000000000, (uint64_t)40000000000, (uint64_t)50000000000, (uint64_t)60000000000, (uint64_t)70000000000, (uint64_t)80000000000, (uint64_t)90000000000,
(uint64_t)100000000000, (uint64_t)200000000000, (uint64_t)300000000000, (uint64_t)400000000000, (uint64_t)500000000000, (uint64_t)600000000000, (uint64_t)700000000000, (uint64_t)800000000000, (uint64_t)900000000000,
(uint64_t)1000000000000, (uint64_t)2000000000000, (uint64_t)3000000000000, (uint64_t)4000000000000, (uint64_t)5000000000000, (uint64_t)6000000000000, (uint64_t)7000000000000, (uint64_t)8000000000000, (uint64_t)9000000000000, // 1 monero
(uint64_t)1000000000000, (uint64_t)2000000000000, (uint64_t)3000000000000, (uint64_t)4000000000000, (uint64_t)5000000000000, (uint64_t)6000000000000, (uint64_t)7000000000000, (uint64_t)8000000000000, (uint64_t)9000000000000, // 1 blur
(uint64_t)10000000000000, (uint64_t)20000000000000, (uint64_t)30000000000000, (uint64_t)40000000000000, (uint64_t)50000000000000, (uint64_t)60000000000000, (uint64_t)70000000000000, (uint64_t)80000000000000, (uint64_t)90000000000000,
(uint64_t)100000000000000, (uint64_t)200000000000000, (uint64_t)300000000000000, (uint64_t)400000000000000, (uint64_t)500000000000000, (uint64_t)600000000000000, (uint64_t)700000000000000, (uint64_t)800000000000000, (uint64_t)900000000000000,
(uint64_t)1000000000000000, (uint64_t)2000000000000000, (uint64_t)3000000000000000, (uint64_t)4000000000000000, (uint64_t)5000000000000000, (uint64_t)6000000000000000, (uint64_t)7000000000000000, (uint64_t)8000000000000000, (uint64_t)9000000000000000,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/epee_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ TEST(StringTools, GetIpInt32)
The existing epee conversion function does not work with 255.255.255.255, for
the reasons specified in the inet_addr documentation. Consider fixing in a
future patch. This address is not likely to be used for purposes within
monero.
blur.
EXPECT_TRUE(epee::string_tools::get_ip_int32_from_string(ip, "255.255.255.255"));
EXPECT_EQ(htonl(0xffffffff), ip);
*/
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/fee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ namespace
TEST_F(fee, double_at_full)
{
static const uint64_t block_rewards[] = {
20000000000000ull, // 20 monero
20000000000000ull, // 20 blur
13000000000000ull,
1000000000000ull,
600000000000ull, // .6 monero, minimum reward per block at 2min
300000000000ull, // .3 monero, minimum reward per block at 1min
600000000000ull, // .6 blur, minimum reward per block at 2min
300000000000ull, // .3 blur, minimum reward per block at 1min
};
static const uint64_t median_block_sizes[] = {
CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2,
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ TEST(Serialization, portability_wallet)
}
}

#define OUTPUT_EXPORT_FILE_MAGIC "BLUR output export\003"
#define OUTPUT_EXPORT_FILE_MAGIC "Blur Network output export\003"
TEST(Serialization, portability_outputs)
{
// read file
Expand Down Expand Up @@ -909,7 +909,7 @@ TEST(Serialization, portability_outputs)
ASSERT_TRUE(td2.m_pk_index == 0);
}

#define UNSIGNED_TX_PREFIX "BLUR unsigned tx set\003"
#define UNSIGNED_TX_PREFIX "Blur Network unsigned tx set\003"
TEST(Serialization, portability_unsigned_tx)
{
const boost::filesystem::path filename = unit_test::data_dir / "unsigned_blur_tx";
Expand Down Expand Up @@ -1057,7 +1057,7 @@ TEST(Serialization, portability_unsigned_tx)
ASSERT_TRUE(td2.m_pk_index == 0);
}

#define SIGNED_TX_PREFIX "BLUR signed tx set\003"
#define SIGNED_TX_PREFIX "Blur Network signed tx set\003"
TEST(Serialization, portability_signed_tx)
{
const boost::filesystem::path filename = unit_test::data_dir / "signed_blur_tx";
Expand Down
Loading

0 comments on commit fd6f01b

Please sign in to comment.