Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishapi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishapi
Commits
db827e6b
Commit
db827e6b
authored
Aug 29, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Log.AttachTmo() to .Timeout()
parent
7d7d7000
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
e2e_test.go
pkg/log/e2e_test.go
+9
-9
log.go
pkg/log/log.go
+4
-4
No files found.
pkg/log/e2e_test.go
View file @
db827e6b
...
...
@@ -59,22 +59,22 @@ func TestAttach(t *testing.T) {
const
zerosec
=
time
.
Duration
(
0
)
func
Test
AttachTmo
(
t
*
testing
.
T
)
{
func
Test
Timeout
(
t
*
testing
.
T
)
{
l
:=
New
()
defer
l
.
Release
()
for
_
,
s
:=
range
[]
int
{
0
,
1
,
-
1
,
^
0
,
int
(
^
uint
(
0
)
>>
1
)}
{
if
e
:=
l
.
AttachTmo
(
time
.
Duration
(
s
)
*
time
.
Second
);
e
!=
nil
{
t
.
Error
(
"
AttachTmo
():"
,
e
)
if
e
:=
l
.
Timeout
(
time
.
Duration
(
s
)
*
time
.
Second
);
e
!=
nil
{
t
.
Error
(
"
Timeout
():"
,
e
)
}
}
var
n
*
Log
if
err
:=
n
.
AttachTmo
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected nil.
AttachTmo
() to fail"
)
if
err
:=
n
.
Timeout
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected nil.
Timeout
() to fail"
)
}
uninit
:=
new
(
Log
)
if
err
:=
uninit
.
AttachTmo
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected uninitialized.
AttachTmo
() to fail"
)
if
err
:=
uninit
.
Timeout
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected uninitialized.
Timeout
() to fail"
)
}
}
...
...
@@ -87,8 +87,8 @@ func TestAttachInstance(t *testing.T) {
f
:=
New
()
defer
f
.
Release
()
if
err
:=
f
.
AttachTmo
(
zerosec
);
err
!=
nil
{
t
.
Error
(
"
AttachTmo
(0s):"
,
err
)
if
err
:=
f
.
Timeout
(
zerosec
);
err
!=
nil
{
t
.
Error
(
"
Timeout
(0s):"
,
err
)
}
if
err
:=
f
.
Attach
(
"instanceDoesNotExist"
);
err
==
nil
{
t
.
Error
(
"expected Attach() to fail for a "
+
...
...
pkg/log/log.go
View file @
db827e6b
...
...
@@ -146,12 +146,12 @@ func (log *Log) initVSM() error {
return
nil
}
//
AttachTmo sets the timeout for attaching to a Varnish instance.
//
The timeout is truncated to seconds. If the truncated timeout >=
//
0s,
then wait that many seconds to attach. If the tmo < 0s, wait
//
Timeout sets the timeout for attaching to a Varnish instance. The
//
timeout is truncated to seconds. If the truncated timeout >= 0s,
// then wait that many seconds to attach. If the tmo < 0s, wait
// indefinitely. By default, the Varnish default timeout holds (5s in
// recent Varnish versions).
func
(
log
*
Log
)
AttachTmo
(
tmo
time
.
Duration
)
error
{
func
(
log
*
Log
)
Timeout
(
tmo
time
.
Duration
)
error
{
if
err
:=
log
.
initVSM
();
err
!=
nil
{
return
err
}
...
...
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