mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-18 05:00:03 +02:00
Cleanup test names.
This commit is contained in:
parent
d2b8e7d0dc
commit
c89da02738
9 changed files with 50 additions and 50 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAtomicAssetFactory(t *testing.T) {
|
||||
func TestAtomicAsset_Factory(t *testing.T) {
|
||||
api := AtomicAssetFactory(ApiArguments{
|
||||
Url: "https://atomic.example.com",
|
||||
NumBlocks: 120,
|
||||
|
|
@ -24,7 +24,7 @@ func TestAtomicAssetFactory(t *testing.T) {
|
|||
assert.Equal(t, expected.block_time, api.(AtomicAsset).block_time)
|
||||
}
|
||||
|
||||
func TestAtomicAssetLogInfo(t *testing.T) {
|
||||
func TestAtomicAsset_LogInfo(t *testing.T) {
|
||||
api := NewAtomicAsset("https://atomic.example.com", 120)
|
||||
|
||||
expected := LogParams{"type", "atomicasset", "url", "https://atomic.example.com", "block_time", float64(120)}
|
||||
|
|
@ -32,7 +32,7 @@ func TestAtomicAssetLogInfo(t *testing.T) {
|
|||
assert.Equal(t, expected, api.LogInfo())
|
||||
}
|
||||
|
||||
func TestAtomicAssetSetTime(t *testing.T) {
|
||||
func TestAtomicAsset_SetTime(t *testing.T) {
|
||||
expected := time.Date(2019, 3, 18, 20, 29, 32, 0, time.UTC)
|
||||
|
||||
api := NewAtomicAsset("", 60)
|
||||
|
|
@ -43,7 +43,7 @@ func TestAtomicAssetSetTime(t *testing.T) {
|
|||
assert.Equal(t, expected, api.GetTime())
|
||||
}
|
||||
|
||||
func TestAtomicAssetJsonFailure(t *testing.T) {
|
||||
func TestAtomicAsset_JsonFailure(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
_, err := res.Write([]byte(`!//{invalid-json}!##`))
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -56,7 +56,7 @@ func TestAtomicAssetJsonFailure(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetHTTP500Down(t *testing.T) {
|
||||
func TestAtomicAsset_HTTP500Down(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
res.Header().Add("Content-type", "application/json; charset=utf-8")
|
||||
res.WriteHeader(500)
|
||||
|
|
@ -73,7 +73,7 @@ func TestAtomicAssetHTTP500Down(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetLaggingUp(t *testing.T) {
|
||||
func TestAtomicAsset_LaggingUp(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
@ -112,7 +112,7 @@ func TestAtomicAssetLaggingUp(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetLaggingDown(t *testing.T) {
|
||||
func TestAtomicAsset_LaggingDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
@ -151,7 +151,7 @@ func TestAtomicAssetLaggingDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetInFutureUp(t *testing.T) {
|
||||
func TestAtomicAsset_InFutureUp(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
@ -190,7 +190,7 @@ func TestAtomicAssetInFutureUp(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetInFutureDown(t *testing.T) {
|
||||
func TestAtomicAsset_InFutureDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
@ -229,7 +229,7 @@ func TestAtomicAssetInFutureDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetRedisDown(t *testing.T) {
|
||||
func TestAtomicAsset_RedisDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
@ -268,7 +268,7 @@ func TestAtomicAssetRedisDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestAtomicAssetPostgresDown(t *testing.T) {
|
||||
func TestAtomicAsset_PostgresDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/health" {
|
||||
payload := `{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestDebugApiFactory(t *testing.T) {
|
||||
func TestDebugApi_Factory(t *testing.T) {
|
||||
api := DebugApiFactory(ApiArguments{
|
||||
Url: "up",
|
||||
Host: "host",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEosioV1Factory(t *testing.T) {
|
||||
func TestEosioV1_Factory(t *testing.T) {
|
||||
api := EosioV1Factory(ApiArguments{
|
||||
Url: "https://api.v1.example.com",
|
||||
Host: "host.example.com",
|
||||
|
|
@ -25,7 +25,7 @@ func TestEosioV1Factory(t *testing.T) {
|
|||
assert.Equal(t, expected.block_time, api.(EosioV1).block_time)
|
||||
}
|
||||
|
||||
func TestEosioV1LogInfo(t *testing.T) {
|
||||
func TestEosioV1_LogInfo(t *testing.T) {
|
||||
api := NewEosioV1("https://api.v1.example.com", "host.example.com", 120)
|
||||
|
||||
expected := LogParams{"type", "eosio-v1", "url", "https://api.v1.example.com", "host", "host.example.com", "block_time", float64(120)}
|
||||
|
|
@ -33,7 +33,7 @@ func TestEosioV1LogInfo(t *testing.T) {
|
|||
assert.Equal(t, expected, api.LogInfo())
|
||||
}
|
||||
|
||||
func TestEosioV1SetTime(t *testing.T) {
|
||||
func TestEosioV1_SetTime(t *testing.T) {
|
||||
expected := time.Date(2022, 2, 24, 13, 38, 0, 0, time.UTC)
|
||||
|
||||
api := NewEosioV1("", "", 60)
|
||||
|
|
@ -44,7 +44,7 @@ func TestEosioV1SetTime(t *testing.T) {
|
|||
assert.Equal(t, expected, api.GetTime())
|
||||
}
|
||||
|
||||
func TestEosioV1JsonFailure(t *testing.T) {
|
||||
func TestEosioV1_JsonFailure(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
_, err := res.Write([]byte(`!//{invalid-json}!##`))
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -57,7 +57,7 @@ func TestEosioV1JsonFailure(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV1HTTP500Failed(t *testing.T) {
|
||||
func TestEosioV1_HTTP500Failed(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
res.WriteHeader(500)
|
||||
_, err := res.Write([]byte(`{}`))
|
||||
|
|
@ -73,7 +73,7 @@ func TestEosioV1HTTP500Failed(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV1LaggingUp(t *testing.T) {
|
||||
func TestEosioV1_LaggingUp(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v1/chain/get_info" {
|
||||
info := `{
|
||||
|
|
@ -97,7 +97,7 @@ func TestEosioV1LaggingUp(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV1LaggingDown(t *testing.T) {
|
||||
func TestEosioV1_LaggingDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v1/chain/get_info" {
|
||||
info := `{
|
||||
|
|
@ -121,7 +121,7 @@ func TestEosioV1LaggingDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV1TimeInFutureUP(t *testing.T) {
|
||||
func TestEosioV1_TimeInFutureUP(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v1/chain/get_info" {
|
||||
info := `{
|
||||
|
|
@ -145,7 +145,7 @@ func TestEosioV1TimeInFutureUP(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV1TimeInFutureDown(t *testing.T) {
|
||||
func TestEosioV1_TimeInFutureDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v1/chain/get_info" {
|
||||
info := `{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEosioV2Factory(t *testing.T) {
|
||||
func TestEosioV2_Factory(t *testing.T) {
|
||||
api := EosioV2Factory(ApiArguments{
|
||||
Url: "https://api.v2.example.com",
|
||||
Host: "host.example.com",
|
||||
|
|
@ -24,7 +24,7 @@ func TestEosioV2Factory(t *testing.T) {
|
|||
assert.Equal(t, expected.offset, api.(EosioV2).offset)
|
||||
}
|
||||
|
||||
func TestEosioV2LogInfo(t *testing.T) {
|
||||
func TestEosioV2_LogInfo(t *testing.T) {
|
||||
api := NewEosioV2("https://api.v2.example.com", "host.example.com", 120)
|
||||
|
||||
expected := LogParams{"type", "eosio-v2", "url", "https://api.v2.example.com", "host", "host.example.com", "offset", int64(120)}
|
||||
|
|
@ -32,7 +32,7 @@ func TestEosioV2LogInfo(t *testing.T) {
|
|||
assert.Equal(t, expected, api.LogInfo())
|
||||
}
|
||||
|
||||
func TestEosioV2JsonFailure(t *testing.T) {
|
||||
func TestEosioV2_JsonFailure(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
_, err := res.Write([]byte(`!//{invalid-json}!##`))
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -45,7 +45,7 @@ func TestEosioV2JsonFailure(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2HTTP500Failed(t *testing.T) {
|
||||
func TestEosioV2_HTTP500Failed(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
res.WriteHeader(500)
|
||||
_, err := res.Write([]byte(`{}`))
|
||||
|
|
@ -61,7 +61,7 @@ func TestEosioV2HTTP500Failed(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2LaggingUp(t *testing.T) {
|
||||
func TestEosioV2_LaggingUp(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -108,7 +108,7 @@ func TestEosioV2LaggingUp(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2LaggingDown(t *testing.T) {
|
||||
func TestEosioV2_LaggingDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -155,7 +155,7 @@ func TestEosioV2LaggingDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2LaggingESInFutureUP(t *testing.T) {
|
||||
func TestEosioV2_LaggingESInFutureUP(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -202,7 +202,7 @@ func TestEosioV2LaggingESInFutureUP(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2LaggingESInFutureDown(t *testing.T) {
|
||||
func TestEosioV2_LaggingESInFutureDown(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -249,7 +249,7 @@ func TestEosioV2LaggingESInFutureDown(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2ElasticsFailed(t *testing.T) {
|
||||
func TestEosioV2_ElasticsFailed(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -296,7 +296,7 @@ func TestEosioV2ElasticsFailed(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2NodeosRPCFailed(t *testing.T) {
|
||||
func TestEosioV2_NodeosRPCFailed(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
@ -343,7 +343,7 @@ func TestEosioV2NodeosRPCFailed(t *testing.T) {
|
|||
assert.Equal(t, expected, check)
|
||||
}
|
||||
|
||||
func TestEosioV2ElasticsNodeosRPCFailed(t *testing.T) {
|
||||
func TestEosioV2_ElasticsNodeosRPCFailed(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.String() == "/v2/health" {
|
||||
info := `{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func TestLogParams(t *testing.T) {
|
|||
assert.ElementsMatch(t, expected, p)
|
||||
}
|
||||
|
||||
func TestLogParamsCombine(t *testing.T) {
|
||||
func TestLogParams_Combine(t *testing.T) {
|
||||
a := LogParams{"one", 1, "string1", "str1"}
|
||||
|
||||
b := LogParams{"two", 2, "string2", "str2"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue