Commit 55476bd0 authored by Kirill Smelkov's avatar Kirill Smelkov

X Run all client tests with both encodings

parent b9009ed2
......@@ -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) {
t.Helper()
withNEOSrv(t, func(t *testing.T, nsrv NEOSrv) {
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)
}, optv...)
}
// TestEncAutodetect verifies that client can autodetect server encoding.
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
// test client with N,M and M,N dial encoding try orders. This
//
// - makes sure that both encodings are working ok (when
// testing against NEO/go), and
//
// - verifies that encoding autodetection actually works when
// NEO/go client connects NEO/py server.
//
// For example if NEO/py server implments only M encoding,
......@@ -543,9 +533,17 @@ func TestEncAutodetect(t *testing.T) {
encvs += fmt.Sprintf("%c", enc)
}
noautodetect, srvEnc := nsrv.BugEncFixed()
t.Run(fmt.Sprintf("dialEncTryOrder=%v", encvs), func(t *testing.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
ndrv, _, err := neoOpen(nsrv.URL(),
&zodb.DriverOptions{ReadOnly: true}); X(err)
......@@ -556,8 +554,7 @@ func TestEncAutodetect(t *testing.T) {
// verify that link was established with either:
// - encv[0] encoding (NEO/go = server supports autodetection)
// - server encoding (NEO/py)
encOK := encv[0]
noautodetect, srvEnc := nsrv.BugEncFixed()
encOK := neonet.DialEncTryOrder[0]
if noautodetect {
encOK = srvEnc
}
......@@ -567,11 +564,14 @@ func TestEncAutodetect(t *testing.T) {
if enc != encOK {
t.Fatalf("connected with encoding %c ; want %c", enc, encOK)
}
f(t, nsrv, ndrv)
})
}
})
}, optv...)
}
// XXX connect with wrong clusterName -> rejected
func TestEmptyDB(t *testing.T) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment