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
}
ctx, err := InitCLI(false)
testza.AssertNoError(t, err)
err := retry.Do(func() error {
ctx, err := InitCLI(false)
if err != nil {
return err
}
err = ctx.Wipe()
testza.AssertNoError(t, err)
err = ctx.Wipe()
if err != nil {
return err
}
err = ctx.ReInit()
testza.AssertNoError(t, err)
err = ctx.ReInit()
if err != nil {
return err
}
ctx.Provider = MockProvider{}
ctx.Provider = MockProvider{}
profileName := "InstallationTest"
profile, err := ctx.Profiles.AddProfile(profileName)
testza.AssertNoError(t, err)
testza.AssertNoError(t, profile.AddMod("AreaActions", "1.6.5"))
testza.AssertNoError(t, profile.AddMod("RefinedPower", "3.2.10"))
profileName := "InstallationTest"
profile, err := ctx.Profiles.AddProfile(profileName)
if err != nil {
return err
}
serverLocation := os.Getenv("SF_DEDICATED_SERVER")
if serverLocation != "" {
time.Sleep(time.Second)
testza.AssertNoError(t, profile.AddMod("AreaActions", "1.6.5"))
testza.AssertNoError(t, profile.AddMod("RefinedPower", "3.2.10"))
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")))
time.Sleep(time.Second)
@ -122,24 +131,27 @@ func TestAddFTPInstallation(t *testing.T) {
if err != nil {
return err
}
testza.AssertNoError(t, err)
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)
time.Sleep(time.Second)
}
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)
}