@@ -12,6 +12,7 @@ import (
1212 "strings"
1313 "sync"
1414 "testing"
15+ "time"
1516
1617 "github.com/stretchr/testify/assert"
1718 "github.com/stretchr/testify/require"
@@ -324,7 +325,11 @@ func TestE2E_QueryTimeout_LiveConnection(t *testing.T) {
324325 cmd := exec .Command (binary , args ... )
325326 cmd .Env = os .Environ ()
326327
328+ // Measure execution time - this is the key validation
329+ // The command should complete in a few seconds, not 10 minutes
330+ start := time .Now ()
327331 output , err := cmd .CombinedOutput ()
332+ elapsed := time .Since (start )
328333 outputStr := string (output )
329334
330335 // The command should fail due to timeout
@@ -333,9 +338,14 @@ func TestE2E_QueryTimeout_LiveConnection(t *testing.T) {
333338 // Output should contain timeout message
334339 assert .Contains (t , outputStr , "Timeout expired" , "output should contain 'Timeout expired' message" )
335340
336- // The key validation: the test itself should complete quickly (not hang for 10 minutes)
337- // If this test completes in a reasonable time, the fix is working
338- t .Logf ("Query timed out correctly: %s" , outputStr )
341+ // Critical: verify the command completed quickly (within 30 seconds, not 10 minutes)
342+ // If the bug exists, this would take ~10 minutes on Linux
343+ maxDuration := 30 * time .Second
344+ if elapsed > maxDuration {
345+ t .Errorf ("Command took too long to complete: %v (expected < %v). The timeout hang bug may still exist." , elapsed , maxDuration )
346+ }
347+
348+ t .Logf ("Query timed out correctly in %v: %s" , elapsed , outputStr )
339349}
340350
341351// cleanupBinary removes the temporary build directory containing the test binary.
0 commit comments