(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func installIntoTestContext(t *testing.T) (string, string, func()) { |
| 62 | appLinkDir, _ := ioutil.TempDir("", ".puma-dev") |
| 63 | libDir, _ := ioutil.TempDir("", "Library") |
| 64 | logFilePath := filepath.Join(libDir, "Logs", "puma-dev.log") |
| 65 | launchAgentDir := filepath.Join(libDir, "LaunchAgents") |
| 66 | assert.NoDirExists(t, launchAgentDir) |
| 67 | |
| 68 | expectedPlistPath := filepath.Join(launchAgentDir, "io.puma.dev.plist") |
| 69 | |
| 70 | cleanup := func() { |
| 71 | exec.Command("launchctl", "unload", expectedPlistPath).Run() |
| 72 | os.RemoveAll(appLinkDir) |
| 73 | os.RemoveAll(logFilePath) |
| 74 | os.RemoveAll(libDir) |
| 75 | } |
| 76 | |
| 77 | generateLivePumaDevCertIfNotExist(t) |
| 78 | |
| 79 | err := InstallIntoSystem(&InstallIntoSystemArgs{ |
| 80 | ListenPort: 10080, |
| 81 | TlsPort: 10443, |
| 82 | Domains: "test:localhost", |
| 83 | Timeout: "5s", |
| 84 | NoServePublicPaths: "", |
| 85 | ApplinkDirPath: appLinkDir, |
| 86 | LaunchAgentDirPath: launchAgentDir, |
| 87 | LogfilePath: logFilePath, |
| 88 | }) |
| 89 | assert.NoError(t, err) |
| 90 | |
| 91 | return launchAgentDir, expectedPlistPath, cleanup |
| 92 | } |
| 93 | |
| 94 | func assertDirUmask(t *testing.T, expectedUmask, path string) { |
| 95 | info, err := os.Stat(path) |
no test coverage detected