package dalamud import ( "errors" "os" "path/filepath" "testing" ) // Live test of the full download path against kamori.goats.dev. Opt-in so // plain `go test` stays offline and light: // // DALAMUD_LIVE=1 go test ./dalamud/ -run TestLiveEnsure // // It downloads the current release, .NET runtime and asset bundle (~150 MB) // into a temp dir and verifies integrity of all three. func TestLiveEnsure(t *testing.T) { if os.Getenv("DALAMUD_LIVE") == "" { t.Skip("set DALAMUD_LIVE=1 to download the real Dalamud release (~150 MB)") } client := newClient() info, err := getVersionInfo(client) if err != nil { t.Fatalf("version info: %v", err) } t.Logf("release=%s gameVer=%s runtime=%s required=%v", info.AssemblyVersion, info.SupportedGameVer, info.RuntimeVersion, info.RuntimeRequired) baseDir := t.TempDir() p, err := Ensure(baseDir, info.SupportedGameVer) if err != nil { t.Fatalf("Ensure: %v", err) } for _, want := range []string{ filepath.Join(p.HooksDir, "Dalamud.Injector.exe"), filepath.Join(p.HooksDir, "Dalamud.dll"), p.AssetDir, } { if _, err := os.Stat(want); err != nil { t.Errorf("expected %s: %v", want, err) } } if info.RuntimeRequired { for _, part := range []string{"host/fxr", "shared/Microsoft.NETCore.App"} { pth := filepath.Join(p.RuntimeDir, filepath.FromSlash(part), info.RuntimeVersion) if _, err := os.Stat(pth); err != nil { t.Errorf("expected runtime %s: %v", pth, err) } } } t.Logf("runner=%s assetDir=%s runtimeDir=%s", p.Runner, p.AssetDir, p.RuntimeDir) if _, err := Ensure(baseDir, "1900.01.01.0000.0000"); err == nil { t.Error("expected ErrVersionMismatch for a bogus game version") } else if !errors.Is(err, ErrVersionMismatch) { t.Errorf("expected ErrVersionMismatch, got %v", err) } }