Makefile: Remove authentication token validity ldflag hack
In the internal/gitaly/server
test suite, we have a test which
verifies that tokens are checked before the actual RPC gets triggered.
This is done quite roundabout via git hooks: we invoke an RPC of which
we know that it triggers hooks, then inside of the hook we sleep for the
token validity duration. If the token was checked after hook
execution, then it wouldn't have been valid anymore and thus failed the
RPC.
There's one problem though: by default, tokens are valid for 30 seconds,
and waiting twice for 30 seconds to fly by in a test is really awkwardly
long. This is why we currently have a hack in our Makefile to decrease
the token validity duration to 5 seconds via a -X
linker flag. Despite
being quite gross, it also has the issue that using go test
directly
without invoking the Makefile doesn't change the value.
Until now, nobody actually bothered because in fact the test doesn't
work: hooks don't get executed at all and thus the UserCreateTag
request finishes quite fast, not hitting the timeout. But if they did,
then using go test
on it would fail currently as we would sleep for
twice the default timeout value, while we have a test timeout of twice
the default timeout value. Given that the we not only sleep for that
exact amount of time but also perform the actual RPC logic, we'd thus
typically hit the timeout and fail the test.
Let's remove this ldflag hack and just use our newly grown
auth.SetTokenValidityDuration()
function, which makes it word both
when using the Makefile and when executing tests directly. Note that
this commit doesn't fix hook execution, as this will become a lot easier
to do as soon as the Go port of UserCreateTag
lands.