t / t9833-errors.shon commit chainlint: recognize multi-line quoted strings more robustly (22e3e02)
   1#!/bin/sh
   2
   3test_description='git p4 errors'
   4
   5. ./lib-git-p4.sh
   6
   7test_expect_success 'start p4d' '
   8        start_p4d
   9'
  10
  11test_expect_success 'add p4 files' '
  12        (
  13                cd "$cli" &&
  14                echo file1 >file1 &&
  15                p4 add file1 &&
  16                p4 submit -d "file1"
  17        )
  18'
  19
  20# after this test, the default user requires a password
  21test_expect_success 'error handling' '
  22        git p4 clone --dest="$git" //depot@all &&
  23        (
  24                cd "$git" &&
  25                P4PORT=: test_must_fail git p4 submit 2>errmsg
  26        ) &&
  27        p4 passwd -P newpassword &&
  28        (
  29                P4PASSWD=badpassword test_must_fail git p4 clone //depot/foo 2>errmsg &&
  30                grep -q "failure accessing depot.*P4PASSWD" errmsg
  31        )
  32'
  33
  34test_expect_success 'ticket logged out' '
  35        P4TICKETS="$cli/tickets" &&
  36        echo "newpassword" | p4 login &&
  37        (
  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
  43        )
  44'
  45
  46test_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
  56
  57        p4 users | grep short_expiry_user
  58'
  59
  60test_expect_success 'git operation with expired ticket' '
  61        P4TICKETS="$cli/tickets" &&
  62        P4USER=short_expiry_user &&
  63        echo "password" | p4 login &&
  64        (
  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
  70        )
  71'
  72
  73test_expect_success 'kill p4d' '
  74        kill_p4d
  75'
  76
  77
  78test_done