revision: tolerate promised targets of tags
[alt-git.git] / t / t9833-errors.sh
blob9ba892de7abff30a81125521cb5e9084cad1b75f
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 test_must_fail git p4 clone //depot/foo 2>errmsg &&
30 grep -q "failure accessing depot.*P4PASSWD" errmsg
34 test_expect_success 'ticket logged out' '
35 P4TICKETS="$cli/tickets" &&
36 echo "newpassword" | p4 login &&
38 cd "$git" &&
39 test_commit "ticket-auth-check" &&
40 p4 logout &&
41 test_must_fail git p4 submit 2>errmsg &&
42 grep -q "failure accessing depot" errmsg
46 test_expect_success 'create group with short ticket expiry' '
47 P4TICKETS="$cli/tickets" &&
48 echo "newpassword" | p4 login &&
49 p4_add_user short_expiry_user &&
50 p4 -u short_expiry_user passwd -P password &&
51 p4 group -i <<-EOF &&
52 Group: testgroup
53 Timeout: 3
54 Users: short_expiry_user
55 EOF
57 p4 users | grep short_expiry_user
60 test_expect_success 'git operation with expired ticket' '
61 P4TICKETS="$cli/tickets" &&
62 P4USER=short_expiry_user &&
63 echo "password" | p4 login &&
65 cd "$git" &&
66 git p4 sync &&
67 sleep 5 &&
68 test_must_fail git p4 sync 2>errmsg &&
69 grep "failure accessing depot" errmsg
73 test_expect_success 'kill p4d' '
74 kill_p4d
78 test_done