fix e2e
add support for supports (heh)
This commit is contained in:
parent
e98061f2eb
commit
577411cf50
3 changed files with 27 additions and 8 deletions
|
@ -56,9 +56,11 @@ status=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT sta
|
||||||
videoStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM synced_video WHERE id=1')
|
videoStatus=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT status FROM synced_video WHERE id=1')
|
||||||
videoClaimID=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=1')
|
videoClaimID=$(mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e 'SELECT claim_id FROM synced_video WHERE id=1')
|
||||||
# Create Supports for published claim
|
# Create Supports for published claim
|
||||||
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","${videoClaimID}",1.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","'${videoClaimID}'",1.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
||||||
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","${videoClaimID}",2.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","'${videoClaimID}'",2.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
||||||
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","${videoClaimID}",3.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","'${videoClaimID}'",3.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
||||||
|
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"supportclaim","params":["@BeamerTest","'${videoClaimID}'",3.0]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
||||||
|
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"generate","params":[1]}' -H 'content-type:text/plain;' --user lbry:lbry http://localhost:15200
|
||||||
# Reset status for tranfer test
|
# Reset status for tranfer test
|
||||||
mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e "UPDATE youtube_data SET status = 'queued' WHERE id = 1"
|
mysql -u lbry -plbry -ss -D lbry -h "127.0.0.1" -P 15500 -e "UPDATE youtube_data SET status = 'queued' WHERE id = 1"
|
||||||
# Trigger transfer api
|
# Trigger transfer api
|
||||||
|
|
|
@ -44,14 +44,23 @@ func abandonSupports(s *Sync) error {
|
||||||
allSupports = append(allSupports, (*supports).Items...)
|
allSupports = append(allSupports, (*supports).Items...)
|
||||||
totalPages = (*supports).TotalPages
|
totalPages = (*supports).TotalPages
|
||||||
}
|
}
|
||||||
|
alreadyAbandoned := make(map[string]bool, len(allSupports))
|
||||||
|
for _, support := range allSupports {
|
||||||
|
_, ok := alreadyAbandoned[support.ClaimID]
|
||||||
|
if ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
alreadyAbandoned[support.ClaimID] = true
|
||||||
|
summary, err := s.daemon.SupportAbandon(&support.ClaimID, nil, nil, nil, nil)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Err(err)
|
||||||
|
}
|
||||||
|
log.Infof("Abandoned support of %s (%s total output) LBC for claim %s", support.Amount, summary.Outputs[0].Amount, support.ClaimID)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func transferVideos(s *Sync) error {
|
func transferVideos(s *Sync) error {
|
||||||
err := waitConfirmations(s)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
cleanTransfer := true
|
cleanTransfer := true
|
||||||
for _, video := range s.syncedVideos {
|
for _, video := range s.syncedVideos {
|
||||||
if !video.Published || video.Transferred || video.MetadataVersion != LatestMetadataVersion {
|
if !video.Published || video.Transferred || video.MetadataVersion != LatestMetadataVersion {
|
||||||
|
|
|
@ -316,6 +316,14 @@ func (s *Sync) FullCycle() (e error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.shouldTransfer() {
|
if s.shouldTransfer() {
|
||||||
|
err := waitConfirmations(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = abandonSupports(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
err = transferVideos(s)
|
err = transferVideos(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue