test(cli): 服务器清单导出期限测试给第一次调用留够启动时间,忙时不再误报
This commit is contained in:
1 file changed
+4
-1
@@ -551,7 +551,10 @@ func TestPreMigrateBackupExportsServers(t *testing.T) {
|
|||||||
func TestServerExportStopsWaitingWithTheContext(t *testing.T) {
|
func TestServerExportStopsWaitingWithTheContext(t *testing.T) {
|
||||||
dir := newPodRig(t)
|
dir := newPodRig(t)
|
||||||
writeTestFile(t, filepath.Join(dir, "servers_fail"), "99", 0o600)
|
writeTestFile(t, filepath.Join(dir, "servers_fail"), "99", 0o600)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Millisecond)
|
// Long enough for the first try to run to its refusal: starting the fake
|
||||||
|
// k3s on a busy machine can take a few hundred ms. Still far below the
|
||||||
|
// 10s retry wait, so waiting it out would fail the check below.
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
_, err := exportMinecraftServers(ctx)
|
_, err := exportMinecraftServers(ctx)
|
||||||
|
|||||||
Reference in new issue
Block a user