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
8ed4cde0
Commit
8ed4cde0
authored
Aug 09, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nil checks for vsm.Attach*() methods.
parent
98969dd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
e2e_test.go
internal/pkg/vsm/e2e_test.go
+9
-0
vsm.go
internal/pkg/vsm/vsm.go
+6
-3
No files found.
internal/pkg/vsm/e2e_test.go
View file @
8ed4cde0
...
...
@@ -143,6 +143,15 @@ func TestAttachInstance(t *testing.T) {
t
.
Error
(
"expected AttachInstance() to fail for a "
+
"non-existent instance"
)
}
var
n
*
VSM
if
err
:=
n
.
AttachInstance
(
"gotest"
,
false
);
err
==
nil
{
t
.
Error
(
"expected nil.AttachInstance() to fail"
)
}
uninit
:=
new
(
VSM
)
if
err
:=
uninit
.
AttachInstance
(
"gotest"
,
false
);
err
==
nil
{
t
.
Error
(
"expected uninitialized.AttachInstance() to fail"
)
}
}
func
TestPointer
(
t
*
testing
.
T
)
{
...
...
internal/pkg/vsm/vsm.go
View file @
8ed4cde0
...
...
@@ -139,9 +139,6 @@ func (v *VSM) AttachTmo(tmo time.Duration) error {
}
func
(
v
*
VSM
)
attach
(
progress
bool
)
error
{
if
err
:=
v
.
checkNil
();
err
!=
nil
{
return
err
}
prog
:=
-
1
if
progress
{
prog
=
0
...
...
@@ -156,12 +153,18 @@ func (v *VSM) attach(progress bool) error {
// Attach attaches to the default instance of Varnish, as documented
// for the Attacher interface.
func
(
v
*
VSM
)
Attach
(
progress
bool
)
error
{
if
err
:=
v
.
checkNil
();
err
!=
nil
{
return
err
}
return
v
.
attach
(
progress
)
}
// AttachInstance attaches to a named instance of Varnish, as
// documented for the Attacher interface.
func
(
v
*
VSM
)
AttachInstance
(
inst
string
,
progress
bool
)
error
{
if
err
:=
v
.
checkNil
();
err
!=
nil
{
return
err
}
C
.
VSM_ResetError
(
v
.
vsm
)
if
C
.
VSM_Arg
(
v
.
vsm
,
'n'
,
C
.
CString
(
inst
))
!=
1
{
return
v
...
...
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