feat(oonirun): improve tests (#915)
See https://github.com/ooni/probe/issues/2184 While there, rename `runtimex.PanicIfFalse` to `runtimex.Assert` (it was about time...)
This commit is contained in:
@@ -17,7 +17,7 @@ func acquireUserConsent(miniooniDir string, currentOptions *Options) {
|
||||
consentFile := path.Join(miniooniDir, "informed")
|
||||
err := maybeWriteConsentFile(currentOptions.Yes, consentFile)
|
||||
runtimex.PanicOnError(err, "cannot write informed consent file")
|
||||
runtimex.PanicIfFalse(
|
||||
runtimex.Assert(
|
||||
regularFileExists(consentFile),
|
||||
riskOfRunningOONI,
|
||||
)
|
||||
|
||||
@@ -308,7 +308,7 @@ func mainSingleIteration(logger model.Logger, experimentName string, currentOpti
|
||||
log.Infof("Current time: %s", time.Now().Format("2006-01-02 15:04:05 MST"))
|
||||
|
||||
homeDir := gethomedir(currentOptions.HomeDir)
|
||||
runtimex.PanicIfFalse(homeDir != "", "home directory is empty")
|
||||
runtimex.Assert(homeDir != "", "home directory is empty")
|
||||
miniooniDir := path.Join(homeDir, ".miniooni")
|
||||
err := os.MkdirAll(miniooniDir, 0700)
|
||||
runtimex.PanicOnError(err, "cannot create $HOME/.miniooni directory")
|
||||
|
||||
Reference in New Issue
Block a user