From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Luke Diamand <luke@diamand.org>
Cc: git@vger.kernel.org,
Johannes Schindelin <johannes.schindelin@gmx.de>,
Luke Diamand <ldiamand@roku.com>
Subject: Re: [PATCHv2] git-p4: ticket expiry test: use a fake p4 to avoid use of 'sleep'
Date: Fri, 8 Feb 2019 21:14:45 +0100 [thread overview]
Message-ID: <20190208201445.GB10587@szeder.dev> (raw)
In-Reply-To: <20190208190231.8134-1-luke@diamand.org>
On Fri, Feb 08, 2019 at 07:02:31PM +0000, Luke Diamand wrote:
> +# create a fake version of "p4" which returns a TicketExpiration based
> +# on $EXPIRY, for testing login expiration
> +create_fake_p4() {
> + (
> + cd "$git" && mkdir expire-p4 &&
> + cat >>expire-p4/p4 <<-EOF &&
> + #!/usr/bin/python
I think this should be $PYTHON_PATH.
> + import marshal, os, subprocess, sys
> + if "login" in sys.argv:
> + marshal.dump({"foo" : "bar", "code" : "stat", "TicketExpiration" : os.environ["EXPIRY"]}, sys.stdout)
> + else:
> + subprocess.check_call([os.environ["P4"]] + sys.argv[1:])
> + EOF
> + chmod 0755 expire-p4/p4
> + )
> +}
>
> test_expect_success 'git operation with expired ticket' '
> - P4TICKETS="$cli/tickets" &&
> - P4USER=short_expiry_user &&
> - echo "password" | p4 login &&
> + create_fake_p4 &&
> + echo "newpassword" | p4 login &&
> (
> cd "$git" &&
> - git p4 sync &&
> - sleep 5 &&
> - test_must_fail git p4 sync 2>errmsg &&
> - grep "failure accessing depot" errmsg
> + P4=$(command -v p4) && export P4 &&
> + EXPIRY=3600 PATH=$PWD/expire-p4:$PATH git p4 sync &&
> + EXPIRY=1 PATH=$PWD/expire-p4:$PATH test_must_fail git p4 sync -v 2>errmsg &&
> + grep "failure accessing depot.*expires in 1 second" errmsg
> )
> '
>
> --
> 2.20.1.612.g17ebf93fb6.dirty
>
next prev parent reply other threads:[~2019-02-08 20:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 19:02 [PATCHv2] git-p4: ticket expiry test: use a fake p4 to avoid use of 'sleep' Luke Diamand
2019-02-08 20:14 ` SZEDER Gábor [this message]
2019-02-09 18:06 ` Junio C Hamano
2019-02-09 19:26 ` Luke Diamand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190208201445.GB10587@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=ldiamand@roku.com \
--cc=luke@diamand.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.