- Notifications
You must be signed in to change notification settings - Fork1k
Commit321c2b8
authored
fix: fix flake in TestExecutorAutostartSkipsWhenNoProvisionersAvailable (#19478)
The flake here had two causes:1. related to usage of time.Now() in MustWaitForProvisionersAvailableand2. the fact that UpdateProvisionerLastSeenAt can not use a time that isfurther in the past than the current LastSeenAt timePreviously the test here was calling`coderdtest.MustWaitForProvisionersAvailable` which was using `time.Now`rather than the next tick time like the real `hasProvisionersAvailable`function does. Additionally, when using `UpdateProvisionerLastSeenAt`the underlying db query enforces that the time we're trying to set`LastSeenAt` to cannot be older than the current value.I was able to reliably reproduce the flake by executing both the`UpdateProvisionerLastSeenAt` call and `tickCh <- next` in their owngoroutines, the former with a small sleep to reliably ensure we'dtrigger the autobuild before we set the `LastSeenAt` time. That's when Ialso noticed that `coderdtest.MustWaitForProvisionersAvailable` wasusing `time.Now` instead of the tick time. When I updated that functionto take in a tick time + added a 2nd call to`UpdateProvisionerLastSeenAt` to set an original non-stale time, wecould then never get the test to pass because the later call to set thestale time would not actually modify `LastSeenAt`. On top of that,calling the provisioner daemons closer in the middle of the functiondoesn't really do anything of value in this test.**The fix for the flake is to keep the go routines, ensuring there wouldbe a flake if there was not a relevant fix, but to include the fix whichis to ensure that we explicitly wait for the provisioner to be stalebefore passing the time to `tickCh`.**---------Signed-off-by: Callum Styan <callumstyan@gmail.com>1 parent95dccf3 commit321c2b8
File tree
3 files changed
+63
-20
lines changed- coderd
- autobuild
- coderdtest
- enterprise/coderd
3 files changed
+63
-20
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
| 7 | + | |
7 | 8 |
| |
8 | 9 |
| |
9 | 10 |
| |
| |||
1720 | 1721 |
| |
1721 | 1722 |
| |
1722 | 1723 |
| |
1723 |
| - | |
1724 |
| - | |
1725 | 1724 |
| |
1726 | 1725 |
| |
1727 | 1726 |
| |
1728 |
| - | |
| 1727 | + | |
| 1728 | + | |
1729 | 1729 |
| |
1730 |
| - | |
1731 |
| - | |
1732 |
| - | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
1733 | 1740 |
| |
1734 |
| - | |
1735 |
| - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
1736 | 1750 |
| |
1737 | 1751 |
| |
1738 | 1752 |
| |
| |||
1758 | 1772 |
| |
1759 | 1773 |
| |
1760 | 1774 |
| |
1761 |
| - | |
| 1775 | + | |
1762 | 1776 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1649 | 1649 |
| |
1650 | 1650 |
| |
1651 | 1651 |
| |
1652 |
| - | |
| 1652 | + | |
| 1653 | + | |
1653 | 1654 |
| |
1654 | 1655 |
| |
1655 |
| - | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1656 | 1685 |
| |
1657 | 1686 |
| |
1658 | 1687 |
| |
1659 |
| - | |
| 1688 | + | |
1660 | 1689 |
| |
1661 |
| - | |
| 1690 | + | |
1662 | 1691 |
| |
1663 | 1692 |
| |
1664 |
| - | |
| 1693 | + | |
1665 | 1694 |
| |
1666 | 1695 |
| |
1667 | 1696 |
| |
| |||
1689 | 1718 |
| |
1690 | 1719 |
| |
1691 | 1720 |
| |
1692 |
| - | |
1693 | 1721 |
| |
1694 | 1722 |
| |
1695 |
| - | |
| 1723 | + | |
1696 | 1724 |
| |
1697 | 1725 |
| |
1698 | 1726 |
| |
1699 | 1727 |
| |
1700 | 1728 |
| |
1701 | 1729 |
| |
1702 | 1730 |
| |
1703 |
| - | |
| 1731 | + | |
1704 | 1732 |
| |
1705 | 1733 |
| |
1706 | 1734 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2242 | 2242 |
| |
2243 | 2243 |
| |
2244 | 2244 |
| |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
2245 | 2248 |
| |
2246 |
| - | |
| 2249 | + | |
2247 | 2250 |
| |
2248 | 2251 |
| |
2249 |
| - | |
2250 | 2252 |
| |
2251 |
| - | |
2252 | 2253 |
| |
2253 | 2254 |
| |
2254 | 2255 |
| |
|
0 commit comments
Comments
(0)