Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
8a59fd32
Unverified
Commit
8a59fd32
authored
Aug 13, 2020
by
acud
Committed by
GitHub
Aug 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename tests to not have fail word (#564)
* rename tests
parent
ae955d43
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
welcome_message_test.go
pkg/debugapi/welcome_message_test.go
+2
-2
welcome_message_test.go
pkg/p2p/libp2p/welcome_message_test.go
+1
-1
message.go
pkg/trojan/message.go
+3
-2
message_test.go
pkg/trojan/message_test.go
+2
-2
No files found.
pkg/debugapi/welcome_message_test.go
View file @
8a59fd32
...
...
@@ -49,7 +49,7 @@ func TestSetWelcomeMessage(t *testing.T) {
wantStatus
:
http
.
StatusOK
,
},
{
desc
:
"
fails
- request entity too large"
,
desc
:
"
error
- request entity too large"
,
wantFail
:
true
,
message
:
`zZZbzbzbzbBzBBZbBbZbbbBzzzZBZBbzzBBBbBzBzzZbbBzBBzBBbZz
bZZZBBbbZbbZzBbzBbzbZBZzBZZbZzZzZzbbZZBZzzbBZBzZzzBBzZZzzZbZZZzbbbzz
...
...
@@ -107,7 +107,7 @@ func TestSetWelcomeMessageInternalServerError(t *testing.T) {
WelcomeMesssage
:
testMessage
,
})
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
wantResp
:=
jsonhttp
.
StatusResponse
{
Message
:
testError
.
Error
(),
...
...
pkg/p2p/libp2p/welcome_message_test.go
View file @
8a59fd32
...
...
@@ -34,7 +34,7 @@ func TestDynamicWelcomeMessage(t *testing.T) {
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.
Maecenas eu aliquam enim. Nulla tincidunt arcu nec nulla condimentum nullam sodales`
// 141 characters
...
...
pkg/trojan/message.go
View file @
8a59fd32
...
...
@@ -42,9 +42,10 @@ const (
NonceSize
=
32
LengthSize
=
2
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
// the input string is taken as a byte slice and hashed
func
NewTopic
(
topic
string
)
Topic
{
...
...
@@ -201,7 +202,7 @@ func (m *Message) toChunk(targets Targets, span []byte) (swarm.Chunk, error) {
return
swarm
.
NewChunk
(
swarm
.
NewAddress
(
hash
),
s
),
nil
}
return
nil
,
err
case
<-
time
.
After
(
MinerTimeout
*
time
.
Second
)
:
case
<-
time
.
After
(
minerTimeout
)
:
return
nil
,
ErrMinerTimeout
}
}
...
...
pkg/trojan/message_test.go
View file @
8a59fd32
...
...
@@ -107,8 +107,8 @@ func TestWrap(t *testing.T) {
}
}
// TestWrap
Fail
tests that the creation of a chunk fails when given targets are invalid
func
TestWrap
Fail
(
t
*
testing
.
T
)
{
// TestWrap
Error
tests that the creation of a chunk fails when given targets are invalid
func
TestWrap
Error
(
t
*
testing
.
T
)
{
m
:=
newTestMessage
(
t
)
emptyTargets
:=
trojan
.
Targets
([]
trojan
.
Target
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment