This will always print "fail" though when the key is released, no matter the hold-time.
one_shot -property of your timer is set, you can do:
if not $timer.is_stopped():
If not, it's a little bit more verbose, but still easy to solve:
var success = false
var button_time = 2
success = false
success = true
On a side note your second
if should really be an
elif: it's impossible that the same key is simultaneously pressed and released during one frame.