Commit 79ccfa2
authored
Go: Fix flaky TestScriptKillWithRoute race condition (#5950)
* Fix flaky TestScriptKillWithRoute by increasing timeout and replacing sleep with polling
The test was flaky because:
1. The script invoked in a goroutine hadn't started executing on the server
before SCRIPT KILL was attempted, causing 'NotBusy' errors.
2. The 5-second timeout was insufficient for slow CI environments.
3. The fixed time.Sleep(1s) at the end was unreliable for confirming
the script was no longer running.
Changes:
- Increase script duration from 6s to 10s to ensure it's still running
when the kill succeeds.
- Increase kill polling timeout from 5s to 8s to accommodate slow
script startup in CI.
- Replace time.Sleep(1s) at the end with a polling loop that waits
for the 'notbusy' state, making the test deterministic.
Signed-off-by: Thomas Zhou <thomas.zhou@improving.com>
Signed-off-by: Thomas Zhou <thomaszhou64@gmail.com>
* Fix flaky TestScriptKillWithRoute by blocking on script execution
Restructure the test to match the working testFunctionKillNoWrite pattern:
- Run InvokeScriptWithRoute in the main thread (blocking) to guarantee
the script is executing on the server before kill is attempted
- Run ScriptKill polling in a goroutine
- Use a longer request timeout (12s) so the invoke call blocks until killed
This eliminates the race condition where ScriptKill was called before
the script started, causing 'NotBusy' errors.
Verified: 250/250 sequential runs with 0 failures.
Fixes #5576
Signed-off-by: Thomas Zhou <thomaszhou64@gmail.com>
---------
Signed-off-by: Thomas Zhou <thomas.zhou@improving.com>
Signed-off-by: Thomas Zhou <thomaszhou64@gmail.com>1 parent cfd91a5 commit 79ccfa2
1 file changed
Lines changed: 28 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2616 | 2616 | | |
2617 | 2617 | | |
2618 | 2618 | | |
2619 | | - | |
2620 | | - | |
2621 | 2619 | | |
2622 | 2620 | | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
2623 | 2626 | | |
2624 | 2627 | | |
2625 | 2628 | | |
| |||
2632 | 2635 | | |
2633 | 2636 | | |
2634 | 2637 | | |
2635 | | - | |
| 2638 | + | |
2636 | 2639 | | |
2637 | 2640 | | |
2638 | | - | |
2639 | | - | |
2640 | | - | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
| 2641 | + | |
| 2642 | + | |
2644 | 2643 | | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
2648 | | - | |
2649 | | - | |
2650 | | - | |
2651 | | - | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
2657 | 2648 | | |
2658 | | - | |
2659 | | - | |
2660 | | - | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
2661 | 2658 | | |
2662 | 2659 | | |
2663 | | - | |
| 2660 | + | |
2664 | 2661 | | |
2665 | | - | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
2666 | 2668 | | |
2667 | 2669 | | |
2668 | 2670 | | |
2669 | | - | |
2670 | | - | |
2671 | 2671 | | |
2672 | 2672 | | |
2673 | 2673 | | |
| |||
0 commit comments