Add sample data from test_variety_of_transactions_and_longish_history.
Rework tests to use the sample data.
This commit is contained in:
parent
71e79c553e
commit
789974227f
9 changed files with 9725 additions and 52 deletions
|
@ -8,21 +8,57 @@ import (
|
|||
"github.com/lbryio/lbcd/chaincfg"
|
||||
)
|
||||
|
||||
// Source: test_variety_of_transactions_and_longish_history (lbry-sdk/tests/integration/transactions)
|
||||
const regTestDBPath = "../testdata/test_variety_of_transactions/lbry-rocksdb"
|
||||
|
||||
var regTestAddrs = [30]string{
|
||||
"mtgiQkd35xpx3TaZ4RBNirf3uSMQ8tXQ7z",
|
||||
"mqMjBtzGTtRty7Y54RqeNLk9QE8rYUfpm3",
|
||||
"n2q8ASDZmib4adu2eU4dPvVvjYeU97pks4",
|
||||
"mzxYWTJogAtduNaeyH9pSSmBSPkJj33HDJ",
|
||||
"mweCKeZkeUUi8RQdHry3Mziphb87vCwiiW",
|
||||
"mp7ZuiZgBNJHFX6DVmeZrCj8SuzVQNDLwb",
|
||||
"n2zZoBocGCcxe6jFo1anbbAsUFMPXdYfnY",
|
||||
"msps28KwRJF77DxhzqD98prdwCrZwdUxJc",
|
||||
"mjvkjuss63pq2mpsRn4Q5tsNKVMLG9qUt7",
|
||||
"miF9cJn8HiX6vsorRDXtZEgcW7BeWowqkX",
|
||||
"mx87wRYFchYaLjXyNaboMuEMRLRboFSPDD",
|
||||
"mhvb94idtQvTSCQk9EB16wLLkSrbWizPRG",
|
||||
"mx3Fu8FDM4nKR9VYtHWPtSGKVt1D588Ay1",
|
||||
"mhqvhX7kLNQ2bUNWZxMhE1z6QEJKrqdV8T",
|
||||
"mgekw8L4xEezFtkYdSarL4sk5Sc8n9UtzG",
|
||||
"myhFrTz99ZHwbGo7qV4D7fJKfji7YJ3vZ8",
|
||||
"mnf8UCVoo6DBq6Tg4QpnFFdV1mFVHi43TF",
|
||||
"mn7hKyh6EA8oLAPkvTd9vPEgzLRejLxkj2",
|
||||
"msfarwFff7LX6DkXk295x3YMnJtR5Yw8uy",
|
||||
"mn8sUv6ryiLn4kzssBTqNaB1oL6qcKDzJ4",
|
||||
"mhwgeQFyi1z1RxNR1CphE8PcwG2xBWcxDp",
|
||||
"n2jKpDXhVaQHiKqhdQYwwykhoYtKtbh8P1",
|
||||
"mhnt4btqpAuiNwjAfFxPEaA4ekCE8faRYN",
|
||||
"mmTFCt6Du1VsdxSKc7f21vYsT75KnRy7NM",
|
||||
"mm1nx1xSmgRponM5tmdq15KREa7f6M36La",
|
||||
"mxMXmMKUqoj19hxEA5r3hZJgirT6nCQh14",
|
||||
"mx2L4iqNGzpuNNsDmjvCpcomefDWLAjdv1",
|
||||
"mohJcUzQdCYL7nEySKNQC8PUzowNS5gGvo",
|
||||
"mjv1vErZiDXsh9TvBDGCBpzobZx7aVYuy7",
|
||||
"mwDPTZzHsM6p1DfDnBeojDLRCDceTcejkT",
|
||||
}
|
||||
|
||||
// const dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// const dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb"
|
||||
|
||||
func TestServerGetHeight(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
s := &BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
}
|
||||
|
||||
req := BlockGetServerHeightReq{}
|
||||
|
@ -36,23 +72,23 @@ func TestServerGetHeight(t *testing.T) {
|
|||
t.Errorf("unmarshal err: %v", err)
|
||||
}
|
||||
t.Logf("resp: %v", string(marshalled))
|
||||
if string(marshalled) != "500" {
|
||||
t.Errorf("bad height: %v", string(marshalled))
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetChunk(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
s := &BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
}
|
||||
|
||||
for index := 0; index < 10; index++ {
|
||||
|
@ -67,34 +103,42 @@ func TestGetChunk(t *testing.T) {
|
|||
t.Errorf("index: %v unmarshal err: %v", index, err)
|
||||
}
|
||||
t.Logf("index: %v resp: %v", index, string(marshalled))
|
||||
switch index {
|
||||
case 0, 1, 2, 3, 4:
|
||||
if len(*resp) != (CHUNK_SIZE * HEADER_SIZE * 2) {
|
||||
t.Errorf("index: %v bad length: %v", index, len(*resp))
|
||||
}
|
||||
case 5:
|
||||
if len(*resp) != 21*112*2 {
|
||||
t.Errorf("index: %v bad length: %v", index, len(*resp))
|
||||
}
|
||||
default:
|
||||
if len(*resp) != 0 {
|
||||
t.Errorf("index: %v bad length: %v", index, len(*resp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetHeader(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
s := &BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
}
|
||||
|
||||
for height := 1000; height < 1010; height++ {
|
||||
for height := 0; height < 700; height += 100 {
|
||||
req := BlockGetHeaderReq(height)
|
||||
var resp *BlockGetHeaderResp
|
||||
err := s.Get_header(nil, &req, &resp)
|
||||
if err != nil {
|
||||
if err != nil && height <= 500 {
|
||||
t.Errorf("height: %v handler err: %v", height, err)
|
||||
}
|
||||
marshalled, err := json.MarshalIndent(resp, "", " ")
|
||||
|
@ -106,13 +150,10 @@ func TestGetHeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetBalance(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
@ -120,16 +161,11 @@ func TestGetBalance(t *testing.T) {
|
|||
s := &BlockchainAddressService{
|
||||
BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
},
|
||||
}
|
||||
|
||||
addrs := []string{
|
||||
"bCoyqs8Pv4pss5EbNuyuokkdkCqEpDoHmG",
|
||||
"bJr6cLth1UmR7wJ14BMc7ch73xBEEV77fV",
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
for _, addr := range regTestAddrs {
|
||||
req := AddressGetBalanceReq{addr}
|
||||
var resp *AddressGetBalanceResp
|
||||
err := s.Get_balance(nil, &req, &resp)
|
||||
|
@ -145,13 +181,10 @@ func TestGetBalance(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetHistory(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
@ -159,16 +192,11 @@ func TestGetHistory(t *testing.T) {
|
|||
s := &BlockchainAddressService{
|
||||
BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
},
|
||||
}
|
||||
|
||||
addrs := []string{
|
||||
"bCoyqs8Pv4pss5EbNuyuokkdkCqEpDoHmG",
|
||||
"bJr6cLth1UmR7wJ14BMc7ch73xBEEV77fV",
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
for _, addr := range regTestAddrs {
|
||||
req := AddressGetHistoryReq{addr}
|
||||
var resp *AddressGetHistoryResp
|
||||
err := s.Get_history(nil, &req, &resp)
|
||||
|
@ -184,13 +212,10 @@ func TestGetHistory(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestListUnspent(t *testing.T) {
|
||||
dbPath := "/Users/swdev1/hub/scribe_db.599529/lbry-rocksdb"
|
||||
// dbPath := "/mnt/d/data/snapshot_1072108/lbry-rocksdb/"
|
||||
secondaryPath := "asdf"
|
||||
db, toDefer, err := db.GetProdDB(dbPath, secondaryPath)
|
||||
db, toDefer, err := db.GetProdDB(regTestDBPath, secondaryPath)
|
||||
defer toDefer()
|
||||
if err != nil {
|
||||
t.Skip("DB not found")
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
@ -198,16 +223,11 @@ func TestListUnspent(t *testing.T) {
|
|||
s := &BlockchainAddressService{
|
||||
BlockchainService{
|
||||
DB: db,
|
||||
Chain: &chaincfg.MainNetParams,
|
||||
Chain: &chaincfg.RegressionNetParams,
|
||||
},
|
||||
}
|
||||
|
||||
addrs := []string{
|
||||
"bCoyqs8Pv4pss5EbNuyuokkdkCqEpDoHmG",
|
||||
"bJr6cLth1UmR7wJ14BMc7ch73xBEEV77fV",
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
for _, addr := range regTestAddrs {
|
||||
req := AddressListUnspentReq{addr}
|
||||
var resp *AddressListUnspentResp
|
||||
err := s.Listunspent(nil, &req, &resp)
|
||||
|
|
BIN
testdata/test_variety_of_transactions/lbry-rocksdb/000005.log
vendored
Normal file
BIN
testdata/test_variety_of_transactions/lbry-rocksdb/000005.log
vendored
Normal file
Binary file not shown.
1
testdata/test_variety_of_transactions/lbry-rocksdb/CURRENT
vendored
Normal file
1
testdata/test_variety_of_transactions/lbry-rocksdb/CURRENT
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
MANIFEST-000004
|
1
testdata/test_variety_of_transactions/lbry-rocksdb/IDENTITY
vendored
Normal file
1
testdata/test_variety_of_transactions/lbry-rocksdb/IDENTITY
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
2c7866e6-c325-4a0e-bfac-4cb01a746a45
|
0
testdata/test_variety_of_transactions/lbry-rocksdb/LOCK
vendored
Normal file
0
testdata/test_variety_of_transactions/lbry-rocksdb/LOCK
vendored
Normal file
2167
testdata/test_variety_of_transactions/lbry-rocksdb/LOG
vendored
Normal file
2167
testdata/test_variety_of_transactions/lbry-rocksdb/LOG
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
testdata/test_variety_of_transactions/lbry-rocksdb/MANIFEST-000004
vendored
Normal file
BIN
testdata/test_variety_of_transactions/lbry-rocksdb/MANIFEST-000004
vendored
Normal file
Binary file not shown.
3742
testdata/test_variety_of_transactions/lbry-rocksdb/OPTIONS-000079
vendored
Normal file
3742
testdata/test_variety_of_transactions/lbry-rocksdb/OPTIONS-000079
vendored
Normal file
File diff suppressed because it is too large
Load diff
3742
testdata/test_variety_of_transactions/lbry-rocksdb/OPTIONS-000081
vendored
Normal file
3742
testdata/test_variety_of_transactions/lbry-rocksdb/OPTIONS-000081
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue