| 1 | package guestos |
| 2 | |
| 3 | import ( |
| 4 | "os/exec" |
| 5 | "path/filepath" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | func TestWindowsResourceExactVMAndRollback(t *testing.T) { |
| 10 | shell, err := exec.LookPath("pwsh") |
| 11 | if err != nil { |
| 12 | t.Skip("PowerShell not installed") |
| 13 | } |
| 14 | query, err := filepath.Abs("windows_resources.ps1") |
| 15 | if err != nil { |
| 16 | t.Fatal(err) |
| 17 | } |
| 18 | cmd := exec.CommandContext(t.Context(), shell, "-NoLogo", "-NoProfile", "-NonInteractive", "-File", filepath.Join("testdata", "windows_resources.ps1"), "-Query", query) |
| 19 | if data, err := cmd.CombinedOutput(); err != nil { |
| 20 | t.Fatalf("Windows resource script failed: %v\n%s", err, data) |
| 21 | } |
| 22 | } |