Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
timothe
duniter
Commits
8673cb03
Commit
8673cb03
authored
Apr 28, 2019
by
Cédric Moreau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[enh] add wotb controls in certification replay
parent
9231a2f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
test/integration/certification/certification-replay.ts
test/integration/certification/certification-replay.ts
+53
-0
No files found.
test/integration/certification/certification-replay.ts
View file @
8673cb03
...
...
@@ -72,6 +72,59 @@ describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
assertEqual
(
reduce
(
reducableFromCat
).
expires_on
,
now
+
4
+
10
)
// The expiration date should have changed! (this is the interest of a replay)
})
test
(
'
should correctly update wotb: current state
'
,
async
(
s1
)
=>
{
assertEqual
(
s1
.
_server
.
dal
.
wotb
.
dumpWoT
(),
`[M] [E] [R] [I] -> Links[maxCert = 40]
[0] [1] [1] [1] -> 1 |
[1] [1] [1] [1] -> 0 |
`
)
})
test
(
'
should correctly update wotb: toc joins (t + 6)
'
,
async
(
s1
,
cat
,
tac
,
toc
)
=>
{
await
s1
.
commit
({
time
:
now
+
6
})
await
s1
.
commit
({
time
:
now
+
6
})
await
toc
.
createIdentity
()
await
cat
.
cert
(
toc
)
await
tac
.
cert
(
toc
)
await
toc
.
join
()
await
s1
.
commit
({
time
:
now
+
6
})
assertEqual
(
s1
.
_server
.
dal
.
wotb
.
dumpWoT
(),
`[M] [E] [R] [I] -> Links[maxCert = 40]
[0] [1] [1] [2] -> 1 |
[1] [1] [1] [2] -> 0 |
[2] [1] [2] [0] -> 0 | 1 |
`
)
})
test
(
'
should correctly update wotb: toc => cat
'
,
async
(
s1
,
cat
,
tac
,
toc
)
=>
{
await
s1
.
commit
({
time
:
now
+
6
})
await
toc
.
cert
(
cat
)
await
s1
.
commit
({
time
:
now
+
12
})
assertEqual
(
s1
.
_server
.
dal
.
wotb
.
dumpWoT
(),
`[M] [E] [R] [I] -> Links[maxCert = 40]
[0] [1] [2] [2] -> 1 | 2 |
[1] [1] [1] [2] -> 0 |
[2] [1] [2] [1] -> 0 | 1 |
`
)
})
test
(
'
should correctly update wotb: cat loses 1 cert
'
,
async
(
s1
)
=>
{
await
s1
.
commit
({
time
:
now
+
12
})
assertEqual
(
s1
.
_server
.
dal
.
wotb
.
dumpWoT
(),
`[M] [E] [R] [I] -> Links[maxCert = 40]
[0] [1] [1] [2] -> 2 |
[1] [1] [1] [1] -> 0 |
[2] [1] [2] [1] -> 0 | 1 |
`
)
})
test
(
'
should correctly update wotb: tac loses 1 cert and gets kicked
'
,
async
(
s1
)
=>
{
await
s1
.
commit
({
time
:
now
+
14
})
// Change `Time`
await
s1
.
commit
({
time
:
now
+
14
})
// Change `MedianTime`
await
s1
.
commit
({
time
:
now
+
14
})
// Kick
assertEqual
(
s1
.
_server
.
dal
.
wotb
.
dumpWoT
(),
`[M] [E] [R] [I] -> Links[maxCert = 40]
[0] [1] [1] [1] -> 2 |
[1] [0] [0] [1] ->
[2] [1] [2] [1] -> 0 | 1 |
`
)
})
after
(()
=>
{
CommonConstants
.
BLOCK_NEW_GENERATED_VERSION
=
10
})
...
...
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