Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kubo_final
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anastasiia Chirikova
kubo_final
Commits
96e98a8e
Commit
96e98a8e
authored
10 years ago
by
Jeromy Johnson
Browse files
Options
Downloads
Patches
Plain Diff
add sharness test for log endpoint
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
89cb4303
Branches
Branches containing commit
No related tags found
1 merge request
!1
New
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/corehttp/logs.go
+4
-0
4 additions, 0 deletions
core/corehttp/logs.go
test/sharness/t0110-gateway.sh
+8
-0
8 additions, 0 deletions
test/sharness/t0110-gateway.sh
thirdparty/eventlog/writer.go
+1
-1
1 addition, 1 deletion
thirdparty/eventlog/writer.go
with
13 additions
and
1 deletion
core/corehttp/logs.go
+
4
−
0
View file @
96e98a8e
...
...
@@ -29,6 +29,9 @@ func (w *writeErrNotifier) Write(b []byte) (int, error) {
default
:
}
}
if
f
,
ok
:=
w
.
w
.
(
http
.
Flusher
);
ok
{
f
.
Flush
()
}
return
n
,
err
}
...
...
@@ -38,6 +41,7 @@ func LogOption() ServeOption {
w
.
WriteHeader
(
200
)
wnf
,
errs
:=
newWriteErrNotifier
(
w
)
eventlog
.
WriterGroup
.
AddWriter
(
wnf
)
log
.
Event
(
n
.
Context
(),
"log API client connected"
)
<-
errs
})
return
mux
,
nil
...
...
This diff is collapsed.
Click to expand it.
test/sharness/t0110-gateway.sh
+
8
−
0
View file @
96e98a8e
...
...
@@ -75,6 +75,14 @@ test_expect_success "GET /webui/ returns code expected" '
test_curl_resp_http_code "http://127.0.0.1:$apiport/webui/" "HTTP/1.1 302 Found" "HTTP/1.1 301 Moved Permanently"
'
test_expect_success
"GET /logs returns logs"
'
test_expect_code 28 curl http://127.0.0.1:$apiport/logs -m1 > log_out
'
test_expect_success
"log output looks good"
'
grep "log API client connected" log_out
'
test_kill_ipfs_daemon
test_done
This diff is collapsed.
Click to expand it.
thirdparty/eventlog/writer.go
+
1
−
1
View file @
96e98a8e
...
...
@@ -26,7 +26,7 @@ func (mw *MirrorWriter) Write(b []byte) (int, error) {
continue
}
j
:=
len
(
mw
.
writers
)
j
:=
len
(
mw
.
writers
)
-
1
for
;
j
>
i
;
j
--
{
if
mw
.
writers
[
j
]
!=
nil
{
mw
.
writers
[
i
],
mw
.
writers
[
j
]
=
mw
.
writers
[
j
],
nil
// swap
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment