Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
55476bd0
Commit
55476bd0
authored
Jan 13, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Run all client tests with both encodings
parent
b9009ed2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
go/neo/client_test.go
go/neo/client_test.go
+25
-25
No files found.
go/neo/client_test.go
View file @
55476bd0
...
@@ -496,29 +496,19 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv), optv ...tOption
...
@@ -496,29 +496,19 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv), optv ...tOption
}
}
}
}
// withNEO tests f on all kinds of NEO servers connected to by NEO client.
// withNEO tests f on all kinds of NEO servers connected to by NEO client with
// all kind of default settings.
func
withNEO
(
t
*
testing
.
T
,
f
func
(
t
*
testing
.
T
,
nsrv
NEOSrv
,
ndrv
*
Client
),
optv
...
tOptions
)
{
func
withNEO
(
t
*
testing
.
T
,
f
func
(
t
*
testing
.
T
,
nsrv
NEOSrv
,
ndrv
*
Client
),
optv
...
tOptions
)
{
t
.
Helper
()
t
.
Helper
()
withNEOSrv
(
t
,
func
(
t
*
testing
.
T
,
nsrv
NEOSrv
)
{
withNEOSrv
(
t
,
func
(
t
*
testing
.
T
,
nsrv
NEOSrv
)
{
t
.
Helper
()
t
.
Helper
()
X
:=
xtesting
.
FatalIf
(
t
)
ndrv
,
_
,
err
:=
neoOpen
(
nsrv
.
URL
(),
&
zodb
.
DriverOptions
{
ReadOnly
:
true
});
X
(
err
)
defer
func
()
{
err
:=
ndrv
.
Close
();
X
(
err
)
}()
f
(
t
,
nsrv
,
ndrv
)
// test client with N,M and M,N dial encoding try orders. This
},
optv
...
)
//
}
// - makes sure that both encodings are working ok (when
// testing against NEO/go), and
//
// TestEncAutodetect verifies that client can autodetect server encoding.
// - verifies that encoding autodetection actually works when
func
TestEncAutodetect
(
t
*
testing
.
T
)
{
withNEOSrv
(
t
,
func
(
t
*
testing
.
T
,
nsrv
NEOSrv
)
{
// test client with N,M and M,N encoding try orders. This
// verifies that encoding autodetection actually works when
// NEO/go client connects NEO/py server.
// NEO/go client connects NEO/py server.
//
//
// For example if NEO/py server implments only M encoding,
// For example if NEO/py server implments only M encoding,
...
@@ -543,9 +533,17 @@ func TestEncAutodetect(t *testing.T) {
...
@@ -543,9 +533,17 @@ func TestEncAutodetect(t *testing.T) {
encvs
+=
fmt
.
Sprintf
(
"%c"
,
enc
)
encvs
+=
fmt
.
Sprintf
(
"%c"
,
enc
)
}
}
noautodetect
,
srvEnc
:=
nsrv
.
BugEncFixed
()
t
.
Run
(
fmt
.
Sprintf
(
"dialEncTryOrder=%v"
,
encvs
),
func
(
t
*
testing
.
T
)
{
t
.
Run
(
fmt
.
Sprintf
(
"dialEncTryOrder=%v"
,
encvs
),
func
(
t
*
testing
.
T
)
{
X
:=
xtesting
.
FatalIf
(
t
)
X
:=
xtesting
.
FatalIf
(
t
)
if
noautodetect
&&
len
(
encv
)
>
1
&&
encv
[
0
]
==
srvEnc
{
// skip - the other case when encv[0] != srvEnc will
// both test autodetection and exchanve via srvEnc.
t
.
Skip
(
"skip: does not excercise client redial"
)
}
neonet
.
DialEncTryOrder
=
encv
neonet
.
DialEncTryOrder
=
encv
ndrv
,
_
,
err
:=
neoOpen
(
nsrv
.
URL
(),
ndrv
,
_
,
err
:=
neoOpen
(
nsrv
.
URL
(),
&
zodb
.
DriverOptions
{
ReadOnly
:
true
});
X
(
err
)
&
zodb
.
DriverOptions
{
ReadOnly
:
true
});
X
(
err
)
...
@@ -556,8 +554,7 @@ func TestEncAutodetect(t *testing.T) {
...
@@ -556,8 +554,7 @@ func TestEncAutodetect(t *testing.T) {
// verify that link was established with either:
// verify that link was established with either:
// - encv[0] encoding (NEO/go = server supports autodetection)
// - encv[0] encoding (NEO/go = server supports autodetection)
// - server encoding (NEO/py)
// - server encoding (NEO/py)
encOK
:=
encv
[
0
]
encOK
:=
neonet
.
DialEncTryOrder
[
0
]
noautodetect
,
srvEnc
:=
nsrv
.
BugEncFixed
()
if
noautodetect
{
if
noautodetect
{
encOK
=
srvEnc
encOK
=
srvEnc
}
}
...
@@ -567,11 +564,14 @@ func TestEncAutodetect(t *testing.T) {
...
@@ -567,11 +564,14 @@ func TestEncAutodetect(t *testing.T) {
if
enc
!=
encOK
{
if
enc
!=
encOK
{
t
.
Fatalf
(
"connected with encoding %c ; want %c"
,
enc
,
encOK
)
t
.
Fatalf
(
"connected with encoding %c ; want %c"
,
enc
,
encOK
)
}
}
f
(
t
,
nsrv
,
ndrv
)
})
})
}
}
})
}
,
optv
...
)
}
}
// XXX connect with wrong clusterName -> rejected
// XXX connect with wrong clusterName -> rejected
func
TestEmptyDB
(
t
*
testing
.
T
)
{
func
TestEmptyDB
(
t
*
testing
.
T
)
{
...
...
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