github.com/avahowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/modules/gateway/persist_test.go (about)

     1  package gateway
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestLoad(t *testing.T) {
     8  	g := newTestingGateway("TestLoad", t)
     9  	id := g.mu.Lock()
    10  	g.addNode(dummyNode)
    11  	g.save()
    12  	g.mu.Unlock(id)
    13  	g.Close()
    14  
    15  	g2, err := New("localhost:0", g.persistDir)
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  	if _, ok := g2.nodes[dummyNode]; !ok {
    20  		t.Fatal("gateway did not load old peer list:", g2.nodes)
    21  	}
    22  }