2019-05-30 20:52:33 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package vouchers_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
"storj.io/storj/pkg/pb"
|
2019-11-14 19:46:15 +00:00
|
|
|
"storj.io/storj/private/testcontext"
|
|
|
|
"storj.io/storj/private/testplanet"
|
2019-05-30 20:52:33 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestVouchers(t *testing.T) {
|
|
|
|
testplanet.Run(t, testplanet.Config{
|
2019-09-04 18:21:02 +01:00
|
|
|
SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 0,
|
2019-05-30 20:52:33 +01:00
|
|
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
|
|
|
satellite := planet.Satellites[0].Local().Node
|
|
|
|
|
2019-09-19 05:46:39 +01:00
|
|
|
conn, err := planet.StorageNodes[0].Dialer.DialNode(ctx, &satellite)
|
2019-09-04 18:21:02 +01:00
|
|
|
require.NoError(t, err)
|
|
|
|
defer ctx.Check(conn.Close)
|
2019-05-30 20:52:33 +01:00
|
|
|
|
2019-09-19 05:46:39 +01:00
|
|
|
client := conn.VouchersClient()
|
2019-05-30 20:52:33 +01:00
|
|
|
|
2019-09-04 18:21:02 +01:00
|
|
|
resp, err := client.Request(ctx, &pb.VoucherRequest{})
|
|
|
|
require.Nil(t, resp)
|
2019-09-19 05:46:39 +01:00
|
|
|
require.Error(t, err, "Vouchers endpoint is deprecated. Please upgrade your storage node to the latest version.")
|
2019-05-30 20:52:33 +01:00
|
|
|
})
|
|
|
|
}
|