chore: maybe?

This commit is contained in:
Vilsol 2023-12-28 02:38:38 +02:00
parent b2d8e22977
commit 87c7327253
No known key found for this signature in database

View file

@ -80,28 +80,37 @@ func TestAddFTPInstallation(t *testing.T) {
return return
} }
ctx, err := InitCLI(false) err := retry.Do(func() error {
testza.AssertNoError(t, err) ctx, err := InitCLI(false)
if err != nil {
return err
}
err = ctx.Wipe() err = ctx.Wipe()
testza.AssertNoError(t, err) if err != nil {
return err
}
err = ctx.ReInit() err = ctx.ReInit()
testza.AssertNoError(t, err) if err != nil {
return err
}
ctx.Provider = MockProvider{} ctx.Provider = MockProvider{}
profileName := "InstallationTest" profileName := "InstallationTest"
profile, err := ctx.Profiles.AddProfile(profileName) profile, err := ctx.Profiles.AddProfile(profileName)
testza.AssertNoError(t, err) if err != nil {
testza.AssertNoError(t, profile.AddMod("AreaActions", "1.6.5")) return err
testza.AssertNoError(t, profile.AddMod("RefinedPower", "3.2.10")) }
serverLocation := os.Getenv("SF_DEDICATED_SERVER") testza.AssertNoError(t, profile.AddMod("AreaActions", "1.6.5"))
if serverLocation != "" { testza.AssertNoError(t, profile.AddMod("RefinedPower", "3.2.10"))
time.Sleep(time.Second)
serverLocation := os.Getenv("SF_DEDICATED_SERVER")
if serverLocation != "" {
time.Sleep(time.Second)
err := retry.Do(func() error {
testza.AssertNoError(t, os.RemoveAll(filepath.Join(serverLocation, "FactoryGame", "Mods"))) testza.AssertNoError(t, os.RemoveAll(filepath.Join(serverLocation, "FactoryGame", "Mods")))
time.Sleep(time.Second) time.Sleep(time.Second)
@ -122,24 +131,27 @@ func TestAddFTPInstallation(t *testing.T) {
if err != nil { if err != nil {
return err return err
} }
testza.AssertNoError(t, err)
return nil time.Sleep(time.Second)
}, }
retry.Attempts(30),
retry.Delay(time.Second),
retry.DelayType(retry.FixedDelay),
retry.OnRetry(func(n uint, err error) {
if n > 0 {
slog.Info("retrying ftp test", slog.Uint64("n", uint64(n)))
}
}),
)
testza.AssertNoError(t, err)
time.Sleep(time.Second) err = ctx.Wipe()
} if err != nil {
return err
}
err = ctx.Wipe() return nil
},
retry.Attempts(30),
retry.Delay(time.Second),
retry.DelayType(retry.FixedDelay),
retry.OnRetry(func(n uint, err error) {
if n > 0 {
slog.Info("retrying ftp test", slog.Uint64("n", uint64(n)))
}
}),
)
testza.AssertNoError(t, err) testza.AssertNoError(t, err)
} }