mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
40 lines
716 B
Go
40 lines
716 B
Go
|
package lntest
|
||
|
|
||
|
import (
|
||
|
"io/ioutil"
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
// TestFeeService tests the itest fee estimating web service.
|
||
|
func TestFeeService(t *testing.T) {
|
||
|
service := startFeeService()
|
||
|
defer service.stop()
|
||
|
|
||
|
service.setFee(5000)
|
||
|
|
||
|
// Wait for service to start accepting connections.
|
||
|
var resp *http.Response
|
||
|
require.Eventually(
|
||
|
t,
|
||
|
func() bool {
|
||
|
var err error
|
||
|
resp, err = http.Get(service.url) // nolint:bodyclose
|
||
|
return err == nil
|
||
|
},
|
||
|
10*time.Second, time.Second,
|
||
|
)
|
||
|
|
||
|
defer resp.Body.Close()
|
||
|
|
||
|
body, err := ioutil.ReadAll(resp.Body)
|
||
|
require.NoError(t, err)
|
||
|
|
||
|
require.Equal(
|
||
|
t, "{\"fee_by_block_target\":{\"2\":20000}}", string(body),
|
||
|
)
|
||
|
}
|