Skip to content

Commit 13797f3

Browse files
committed
wip
1 parent 4d1ee67 commit 13797f3

File tree

2 files changed

+459
-0
lines changed

2 files changed

+459
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
use ../../test.nu *
2+
use std assert
3+
4+
# Create a remote server.
5+
let remote_server = spawn -n remote
6+
7+
# Create a local server.
8+
let local_server = spawn -n local
9+
10+
# Add the remote.
11+
let output = tg remote put local $remote_server.url | complete
12+
success $output
13+
14+
# Use the pre-generated test directory with a deep process tree (100 processes deep).
15+
const path = path self "../../../../test_process_completeness"
16+
17+
# Build the module.
18+
let output = run tg -u $local_server.url build -d $path | from json
19+
20+
# Parse the process ID.
21+
let process_id = $output.process
22+
23+
# Wait for the process to complete.
24+
tg wait $process_id
25+
26+
# First push.
27+
let first_push = tg -u $local_server.url push -r local --recursive $process_id | complete
28+
success $first_push
29+
30+
# Parse the number of objects from the first push.
31+
# The output format is "pushed {} processes, {} objects, {} bytes".
32+
let first_match = ($first_push.stderr | parse -r 'pushed (\d+) processes, (\d+) objects, (\d+) bytes')
33+
assert (($first_match | length) > 0) "expected to find push output in first push"
34+
let first_processes = $first_match.0.capture0 | into int
35+
let first_objects = $first_match.0.capture1 | into int
36+
let first_bytes = $first_match.0.capture2 | into int
37+
print -e $first_push.stderr
38+
39+
# Index.
40+
run tg -u $local_server.url index
41+
run tg -u $remote_server.url index
42+
43+
let second_push = tg -u $local_server.url push -r local --recursive --commands $process_id | complete
44+
success $second_push
45+
46+
# Parse the number of objects from the second push.
47+
print -e $second_push.stderr
48+
let second_match = ($second_push.stderr | parse -r 'pushed (\d+) processes, (\d+) objects, (\d+) bytes')
49+
assert (($second_match | length) > 0) "expected to find push output in second push"
50+
let second_processes = $second_match.0.capture0 | into int
51+
let second_objects = $second_match.0.capture1 | into int
52+
let second_bytes = $second_match.0.capture2 | into int
53+
54+
exit 1
55+
56+
assert ($second_objects < $first_objects) $"expected second push to have fewer objects \(($second_objects)\) than first push \(($first_objects)\)"

0 commit comments

Comments
 (0)