fe2340285f
https://storjlabs.atlassian.net/browse/SG-145 Change-Id: Idee6050cea5fd53ec631a7c64fb18f1ad7f16af0
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package consoleserver_test
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"storj.io/common/testcontext"
|
|
"storj.io/storj/private/testplanet"
|
|
)
|
|
|
|
func TestConsole(t *testing.T) {
|
|
testplanet.Run(t,
|
|
testplanet.Config{
|
|
SatelliteCount: 1,
|
|
StorageNodeCount: 1,
|
|
},
|
|
func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
|
satellite := planet.Satellites[0]
|
|
console := planet.StorageNodes[0].Console
|
|
|
|
t.Run("test endpoints", func(t *testing.T) {
|
|
addr := console.Listener.Addr()
|
|
|
|
req, err := http.Get(fmt.Sprintf("http://%s/api/sno", addr))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, req)
|
|
_ = req.Body.Close()
|
|
require.Equal(t, http.StatusOK, req.StatusCode)
|
|
|
|
req, err = http.Get(fmt.Sprintf("http://%s/api/sno/satellites", addr))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, req)
|
|
_ = req.Body.Close()
|
|
require.Equal(t, http.StatusOK, req.StatusCode)
|
|
|
|
req, err = http.Get(fmt.Sprintf("http://%s/api/sno/satellite/%s", addr, satellite.ID()))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, req)
|
|
_ = req.Body.Close()
|
|
require.Equal(t, http.StatusOK, req.StatusCode)
|
|
})
|
|
},
|
|
)
|
|
}
|