]>
Commit | Line | Data |
---|---|---|
ed10cb95 BW |
1 | #!/bin/sh |
2 | ||
3 | test_description='test git-serve and server commands' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success 'test capability advertisement' ' | |
8 | cat >expect <<-EOF && | |
9 | version 2 | |
10 | agent=git/$(git version | cut -d" " -f3) | |
11 | 0000 | |
12 | EOF | |
13 | ||
14 | git serve --advertise-capabilities >out && | |
15 | test-pkt-line unpack <out >actual && | |
16 | test_cmp actual expect | |
17 | ' | |
18 | ||
19 | test_expect_success 'stateless-rpc flag does not list capabilities' ' | |
20 | # Empty request | |
21 | test-pkt-line pack >in <<-EOF && | |
22 | 0000 | |
23 | EOF | |
24 | git serve --stateless-rpc >out <in && | |
25 | test_must_be_empty out && | |
26 | ||
27 | # EOF | |
28 | git serve --stateless-rpc >out && | |
29 | test_must_be_empty out | |
30 | ' | |
31 | ||
32 | test_expect_success 'request invalid capability' ' | |
33 | test-pkt-line pack >in <<-EOF && | |
34 | foobar | |
35 | 0000 | |
36 | EOF | |
37 | test_must_fail git serve --stateless-rpc 2>err <in && | |
38 | test_i18ngrep "unknown capability" err | |
39 | ' | |
40 | ||
41 | test_expect_success 'request with no command' ' | |
42 | test-pkt-line pack >in <<-EOF && | |
43 | agent=git/test | |
44 | 0000 | |
45 | EOF | |
46 | test_must_fail git serve --stateless-rpc 2>err <in && | |
47 | test_i18ngrep "no command requested" err | |
48 | ' | |
49 | ||
50 | test_expect_success 'request invalid command' ' | |
51 | test-pkt-line pack >in <<-EOF && | |
52 | command=foo | |
53 | agent=git/test | |
54 | 0000 | |
55 | EOF | |
56 | test_must_fail git serve --stateless-rpc 2>err <in && | |
57 | test_i18ngrep "invalid command" err | |
58 | ' | |
59 | ||
60 | test_done |