Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
d344db94
Commit
d344db94
authored
Jun 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7b7e0242
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+14
-7
No files found.
wcfs/δbtail_test.go
View file @
d344db94
...
...
@@ -46,11 +46,13 @@ import (
"github.com/stretchr/testify/require"
)
// TreeGen represents connection to running `treegen trees` server.
// TreeSrv represents connection to running `treegen trees` server.
//
// Create it with StartTree
Gen
(zurl).
// Create it with StartTree
Srv
(zurl).
// - Commit(treeTopology) -> tid
type
Tree
Gen
struct
{
type
Tree
Srv
struct
{
zurl
string
pysrv
*
exec
.
Cmd
// spawned `treegen trees`
pyin
io
.
WriteCloser
// input to pysrv
...
...
@@ -61,11 +63,11 @@ type TreeGen struct {
}
// StartTreeGen spawns `treegen trees` server.
func
StartTreeGen
(
zurl
string
)
(
_
*
Tree
Gen
,
err
error
)
{
func
StartTreeGen
(
zurl
string
)
(
_
*
Tree
Srv
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %s: start"
,
zurl
)
// spawn `treegen trees`
tg
:=
&
Tree
Gen
{
zurl
:
zurl
}
tg
:=
&
Tree
Srv
{
zurl
:
zurl
}
tg
.
pysrv
=
exec
.
Command
(
"./testprog/treegen.py"
,
"trees"
,
zurl
)
tg
.
pyin
,
err
=
tg
.
pysrv
.
StdinPipe
()
if
err
!=
nil
{
...
...
@@ -119,7 +121,7 @@ func StartTreeGen(zurl string) (_ *TreeGen, err error) {
}
// Close shutdowns treegen server.
func
(
tg
*
Tree
Gen
)
Close
()
(
err
error
)
{
func
(
tg
*
Tree
Srv
)
Close
()
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %s: close"
,
tg
.
zurl
)
err1
:=
tg
.
pyin
.
Close
()
...
...
@@ -129,7 +131,7 @@ func (tg *TreeGen) Close() (err error) {
}
// Commit creates new commit with underlying tree changed to specified tree topology.
func
(
tg
*
Tree
Gen
)
Commit
(
tree
string
)
(
_
zodb
.
Tid
,
err
error
)
{
func
(
tg
*
Tree
Srv
)
Commit
(
tree
string
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %s: commit %s"
,
tg
.
zurl
,
tree
)
_
,
err
=
io
.
WriteString
(
tg
.
pyin
,
tree
+
"
\n
"
)
...
...
@@ -507,6 +509,7 @@ func TestΔBTreeAllStructs(t *testing.T) {
for
k
:=
range
keys2
{
kv2
[
Key
(
k
)]
=
randv
()
}
// given (kv1, kv2) test on automatically generated (tree1 -> tree2)
//reqSeed = rng.Int63()
fmt
.
Printf
(
"%s -> %s
\n
"
,
kvtxt
(
kv1
),
kvtxt
(
kv2
))
//testq <- ...
...
...
@@ -603,6 +606,10 @@ func TestKVDiff(t *testing.T) {
// kvtxt returns string representation of {} kv.
func
kvtxt
(
kv
map
[
Key
]
string
)
string
{
if
len
(
kv
)
==
0
{
return
"ø"
}
keyv
:=
[]
Key
{}
for
k
:=
range
kv
{
keyv
=
append
(
keyv
,
k
)
}
sort
.
Slice
(
keyv
,
func
(
i
,
j
int
)
bool
{
return
keyv
[
i
]
<
keyv
[
j
]
})
...
...
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