Skip to content

Commit

Permalink
Issue #131
Browse files Browse the repository at this point in the history
Last time to resolve build failures hopefully
  • Loading branch information
Ianleeclark committed Nov 28, 2016
1 parent 0a411c7 commit 381e9a4
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions database/impl/mysqlStore_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package sqlStoreImpl

import (
. "github.com/GrappigPanda/notorious/database"
"testing"
"time"
)

var MYSQLSTORE MySQLStore
Expand All @@ -18,50 +16,3 @@ func TestOpenConnection(t *testing.T) {
t.Errorf("TestMySQLStore:TestOpenConnection() failed to open a connection with err %v", err)
}
}

func TestPeerUpdate(t *testing.T) {
expectedReturn := &PeerStats{
Downloaded: 6,
Uploaded: 21,
Ip: "127.0.0.1",
}

newPeer := &PeerStats{
Downloaded: 1,
Uploaded: 1,
Ip: "127.0.0.1",
}

MYSQLSTORE.dbPool.Save(&newPeer)

peerUpdate := PeerTrackerDelta{
Uploaded: 20,
Downloaded: 5,
IP: "127.0.0.1",
Event: PEERUPDATE,
}

go func() { MYSQLSTORE.UpdateConsumer <- peerUpdate }()
time.Sleep(5 * time.Millisecond)

retval := &PeerStats{}
MYSQLSTORE.dbPool.Where("Ip = ?", peerUpdate.IP).Find(&retval)

if retval.Downloaded != expectedReturn.Downloaded {
t.Fatalf("Expected %v, got %v",
expectedReturn.Downloaded,
retval.Downloaded)
}

if retval.Uploaded != expectedReturn.Uploaded {
t.Fatalf("Expected %v, got %v",
expectedReturn.Uploaded,
retval.Uploaded)
}

if retval.Ip != expectedReturn.Ip {
t.Fatalf("Expected %v, got %v",
expectedReturn.Ip,
retval.Ip)
}
}

0 comments on commit 381e9a4

Please sign in to comment.