Commit 8a59fd32 authored by acud's avatar acud Committed by GitHub

rename tests to not have fail word (#564)

* rename tests
parent ae955d43
...@@ -49,7 +49,7 @@ func TestSetWelcomeMessage(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestSetWelcomeMessage(t *testing.T) {
wantStatus: http.StatusOK, wantStatus: http.StatusOK,
}, },
{ {
desc: "fails - request entity too large", desc: "error - request entity too large",
wantFail: true, wantFail: true,
message: `zZZbzbzbzbBzBBZbBbZbbbBzzzZBZBbzzBBBbBzBzzZbbBzBBzBBbZz message: `zZZbzbzbzbBzBBZbBbZbbbBzzzZBZBbzzBBBbBzBzzZbbBzBBzBBbZz
bZZZBBbbZbbZzBbzBbzbZBZzBZZbZzZzZzbbZZBZzzbBZBzZzzBBzZZzzZbZZZzbbbzz bZZZBBbbZbbZzBbzBbzbZBZzBZZbZzZzZzbbZZBZzzbBZBzZzzBBzZZzzZbZZZzbbbzz
...@@ -107,7 +107,7 @@ func TestSetWelcomeMessageInternalServerError(t *testing.T) { ...@@ -107,7 +107,7 @@ func TestSetWelcomeMessageInternalServerError(t *testing.T) {
WelcomeMesssage: testMessage, WelcomeMesssage: testMessage,
}) })
body := bytes.NewReader(data) body := bytes.NewReader(data)
t.Run("internal server error - failed to store", func(t *testing.T) { t.Run("internal server error - error on store", func(t *testing.T) {
wantCode := http.StatusInternalServerError wantCode := http.StatusInternalServerError
wantResp := jsonhttp.StatusResponse{ wantResp := jsonhttp.StatusResponse{
Message: testError.Error(), Message: testError.Error(),
......
...@@ -34,7 +34,7 @@ func TestDynamicWelcomeMessage(t *testing.T) { ...@@ -34,7 +34,7 @@ func TestDynamicWelcomeMessage(t *testing.T) {
t.Fatalf("expected: %s. got %s", testMessage, got) t.Fatalf("expected: %s. got %s", testMessage, got)
} }
}) })
t.Run("fails - message too long", func(t *testing.T) { t.Run("error - message too long", func(t *testing.T) {
const testMessage = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. const testMessage = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas eu aliquam enim. Nulla tincidunt arcu nec nulla condimentum nullam sodales` // 141 characters Maecenas eu aliquam enim. Nulla tincidunt arcu nec nulla condimentum nullam sodales` // 141 characters
......
...@@ -42,9 +42,10 @@ const ( ...@@ -42,9 +42,10 @@ const (
NonceSize = 32 NonceSize = 32
LengthSize = 2 LengthSize = 2
TopicSize = 32 TopicSize = 32
MinerTimeout = 20 // seconds after which the mining will fail
) )
var minerTimeout = 10 * time.Second
// NewTopic creates a new Topic variable with the given input string // NewTopic creates a new Topic variable with the given input string
// the input string is taken as a byte slice and hashed // the input string is taken as a byte slice and hashed
func NewTopic(topic string) Topic { func NewTopic(topic string) Topic {
...@@ -201,7 +202,7 @@ func (m *Message) toChunk(targets Targets, span []byte) (swarm.Chunk, error) { ...@@ -201,7 +202,7 @@ func (m *Message) toChunk(targets Targets, span []byte) (swarm.Chunk, error) {
return swarm.NewChunk(swarm.NewAddress(hash), s), nil return swarm.NewChunk(swarm.NewAddress(hash), s), nil
} }
return nil, err return nil, err
case <-time.After(MinerTimeout * time.Second): case <-time.After(minerTimeout):
return nil, ErrMinerTimeout return nil, ErrMinerTimeout
} }
} }
......
...@@ -107,8 +107,8 @@ func TestWrap(t *testing.T) { ...@@ -107,8 +107,8 @@ func TestWrap(t *testing.T) {
} }
} }
// TestWrapFail tests that the creation of a chunk fails when given targets are invalid // TestWrapError tests that the creation of a chunk fails when given targets are invalid
func TestWrapFail(t *testing.T) { func TestWrapError(t *testing.T) {
m := newTestMessage(t) m := newTestMessage(t)
emptyTargets := trojan.Targets([]trojan.Target{}) emptyTargets := trojan.Targets([]trojan.Target{})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment