Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
37eedf5c
Commit
37eedf5c
authored
Sep 11, 2015
by
Alexander Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix race in test
Signed-off-by:
Alexander Morozov
<
lk4d4@docker.com
>
parent
dc4a5ae1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
middleware/markdown/watcher_test.go
middleware/markdown/watcher_test.go
+8
-1
No files found.
middleware/markdown/watcher_test.go
View file @
37eedf5c
...
@@ -3,6 +3,7 @@ package markdown
...
@@ -3,6 +3,7 @@ package markdown
import
(
import
(
"fmt"
"fmt"
"strings"
"strings"
"sync"
"testing"
"testing"
"time"
"time"
)
)
...
@@ -23,12 +24,18 @@ func TestWatcher(t *testing.T) {
...
@@ -23,12 +24,18 @@ func TestWatcher(t *testing.T) {
}
}
out
=
""
out
=
""
i
=
0
i
=
0
var
mu
sync
.
Mutex
stopChan
=
TickerFunc
(
interval
,
func
()
{
stopChan
=
TickerFunc
(
interval
,
func
()
{
i
++
i
++
mu
.
Lock
()
out
+=
fmt
.
Sprint
(
i
)
out
+=
fmt
.
Sprint
(
i
)
mu
.
Unlock
()
})
})
time
.
Sleep
(
interval
*
10
)
time
.
Sleep
(
interval
*
10
)
if
!
strings
.
HasPrefix
(
out
,
expected
)
||
out
==
expected
{
mu
.
Lock
()
res
:=
out
mu
.
Unlock
()
if
!
strings
.
HasPrefix
(
res
,
expected
)
||
res
==
expected
{
t
.
Fatalf
(
"expected (%v) must be a proper prefix of out(%v)."
,
expected
,
out
)
t
.
Fatalf
(
"expected (%v) must be a proper prefix of out(%v)."
,
expected
,
out
)
}
}
}
}
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