Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
9c017b72
Commit
9c017b72
authored
May 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
59723377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
6 deletions
+38
-6
go/xcommon/xnet/lonet/registry_sqlite_test.go
go/xcommon/xnet/lonet/registry_sqlite_test.go
+38
-6
No files found.
go/xcommon/xnet/lonet/registry_sqlite_test.go
View file @
9c017b72
...
...
@@ -52,12 +52,12 @@ func TestRegistrySQLite(t *testing.T) {
t
.
Helper
()
osladdr
,
err
:=
r
.
Query
(
ctx
,
hostname
)
if
cause
,
iserr
:=
expect
.
(
error
);
iserr
{
if
ewant
,
iserr
:=
expect
.
(
error
);
iserr
{
// error expected
e
,
ok
:=
err
.
(
*
registryError
)
if
!
(
ok
&&
e
.
Err
==
cause
&&
osladdr
==
""
)
{
if
!
(
ok
&&
e
.
Err
==
ewant
&&
osladdr
==
""
)
{
t
.
Fatalf
(
"%s: query %q:
\n
want:
\"\"
, %v
\n
have: %q, %v"
,
r
.
uri
,
hostname
,
cause
,
osladdr
,
err
)
r
.
uri
,
hostname
,
ewant
,
osladdr
,
err
)
}
}
else
{
// !error expected
...
...
@@ -69,13 +69,45 @@ func TestRegistrySQLite(t *testing.T) {
}
}
// announce checks that result of Announce(hostname, osladdr) is as expected
//
// if len(errv) == 1 - it checks that Announce returns error with cause == errv[0].
// otherwise it will check that Announce succeeds and returns nil error.
announce
:=
func
(
r
*
sqliteRegistry
,
hostname
,
osladdr
string
,
errv
...
error
)
{
t
.
Helper
()
err
:=
r
.
Announce
(
ctx
,
hostname
,
osladdr
)
var
ewant
error
if
len
(
errv
)
>
0
{
ewant
=
errv
[
0
]
if
len
(
errv
)
>
1
{
panic
(
"only 1 error allowed in announce check"
)
}
}
if
ewant
!=
nil
{
// error expected
e
,
ok
:=
err
.
(
*
registryError
)
if
(
!
ok
&&
e
.
Err
==
ewant
)
{
t
.
Fatalf
(
"%s: announce %q %q:
\n
want %v
\n
have: %v"
,
r
.
uri
,
hostname
,
osladdr
,
ewant
,
err
)
}
}
else
{
// !error expected
if
err
!=
nil
{
t
.
Fatalf
(
"%s: announce %q %q: %s"
,
r
.
uri
,
hostname
,
osladdr
,
err
)
}
}
}
ø
:=
errNoHost
// r.Network() == ...
// r.Query("α") == ø
query
(
r
,
"α"
,
ø
)
// r.Announce("α", "alpha:1234")
// r.Query("α") == "alpha:1234")
announce
(
r
,
"α"
,
"alpha:1234"
)
announce
(
r
,
"α"
,
"alpha:1234"
,
errHostDup
)
announce
(
r
,
"α"
,
"alpha:1235"
,
errHostDup
)
query
(
r
,
"α"
,
"alpha:1234"
)
// r.Query("β") == ø
r2
,
err
:=
openRegistrySQLite
(
ctx
,
dbpath
)
...
...
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