tests: include detailed trace logs with --write-junit-xml upon failure
[git.git] / t / t9833-errors.sh
blob277d34701201af03d0efbcfe05336b6cfec5483b
1 #!/bin/sh
3 test_description='git p4 errors'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 test_expect_success 'add p4 files' '
13 cd "$cli" &&
14 echo file1 >file1 &&
15 p4 add file1 &&
16 p4 submit -d "file1"
20 # after this test, the default user requires a password
21 test_expect_success 'error handling' '
22 git p4 clone --dest="$git" //depot@all &&
24 cd "$git" &&
25 P4PORT=: test_must_fail git p4 submit 2>errmsg
26 ) &&
27 p4 passwd -P newpassword &&
29 P4PASSWD=badpassword &&
30 export P4PASSWD &&
31 test_must_fail git p4 clone //depot/foo 2>errmsg &&
32 grep -q "failure accessing depot.*P4PASSWD" errmsg
36 test_expect_success 'ticket logged out' '
37 P4TICKETS="$cli/tickets" &&
38 echo "newpassword" | p4 login &&
40 cd "$git" &&
41 test_commit "ticket-auth-check" &&
42 p4 logout &&
43 test_must_fail git p4 submit 2>errmsg &&
44 grep -q "failure accessing depot" errmsg
48 test_expect_success 'create group with short ticket expiry' '
49 P4TICKETS="$cli/tickets" &&
50 echo "newpassword" | p4 login &&
51 p4_add_user short_expiry_user &&
52 p4 -u short_expiry_user passwd -P password &&
53 p4 group -i <<-EOF &&
54 Group: testgroup
55 Timeout: 3
56 Users: short_expiry_user
57 EOF
59 p4 users | grep short_expiry_user
62 test_expect_success 'git operation with expired ticket' '
63 P4TICKETS="$cli/tickets" &&
64 P4USER=short_expiry_user &&
65 echo "password" | p4 login &&
67 cd "$git" &&
68 git p4 sync &&
69 sleep 5 &&
70 test_must_fail git p4 sync 2>errmsg &&
71 grep "failure accessing depot" errmsg
75 test_expect_success 'kill p4d' '
76 kill_p4d
80 test_done