2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-12-14 19:23:54 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package discovery_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2019-01-30 20:29:33 +00:00
|
|
|
"time"
|
2018-12-14 19:23:54 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
|
|
|
"storj.io/storj/internal/testcontext"
|
|
|
|
"storj.io/storj/internal/testplanet"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCache_Refresh(t *testing.T) {
|
|
|
|
ctx := testcontext.New(t)
|
|
|
|
defer ctx.Cleanup()
|
|
|
|
|
2019-01-30 20:29:33 +00:00
|
|
|
planet, err := testplanet.New(t, 1, 10, 0)
|
2018-12-14 19:23:54 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
defer ctx.Check(planet.Shutdown)
|
|
|
|
|
|
|
|
planet.Start(ctx)
|
2019-01-30 20:29:33 +00:00
|
|
|
time.Sleep(2 * time.Second)
|
|
|
|
|
|
|
|
satellite := planet.Satellites[0]
|
|
|
|
for _, storageNode := range planet.StorageNodes {
|
|
|
|
node, err := satellite.Overlay.Service.Get(ctx, storageNode.ID())
|
|
|
|
if assert.NoError(t, err) {
|
|
|
|
assert.Equal(t, storageNode.Addr(), node.Address.Address)
|
|
|
|
}
|
|
|
|
}
|
2018-12-14 19:23:54 +00:00
|
|
|
}
|