func TestMain(m *testing.M) {
	curUser, err := user.Current()
	if err != nil {
		fmt.Println("Could not determine running user")
	}
	userString = curUser.Username
	fmt.Printf("currently running tests as: %s \n", userString)
	fmt.Println("Don't forget to run both root and user tests.")
	retCode := m.Run()
	if userString == "root" || userString == "system" {
		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
		defer cancel()
		Restart(ctx, "nginx", Options{UserMode: false})
	}
	os.Exit(retCode)
}
// Testing assumptions
// - there's no unit installed named `nonexistant`
// - the syncthing unit to be available on the tester's system.
//   this is just what was available on mine, should you want to change it,
//   either to something in this repo or more common, feel free to submit a PR.
// - your 'user' isn't root
// - your user doesn't have a PolKit rule allowing access to configure nginx
Testing assumptions
- there's no unit installed named `nonexistant`
- the syncthing unit to be available on the tester's system.
this is just what was available on mine, should you want to change it,
either to something in this repo or more common, feel free to submit a PR.
- your 'user' isn't root
- your user doesn't have a PolKit rule allowing access to configure nginx
// Testing assumptions // - there ' s no unit installed named ` nonexistant ` // - the syncthing unit to be available on the tester ' s system . // this is just what was available on mine should you want to change it // either to something in this repo or more common feel free to submit a PR . // - your ' user ' isn ' t root // - your user doesn ' t have a PolKit rule allowing access to configure nginx
func TestMain(m *testing.M) {
	curUser, err := user.Current()
	if err != nil {
		fmt.Println("Could not determine running user")
	}
	userString = curUser.Username
	fmt.Printf("currently running tests as: %s \n", userString)
	fmt.Println("Don't forget to run both root and user tests.")
	retCode := m.Run()
	if userString == "root" || userString == "system" {
		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
		defer cancel()
		Restart(ctx, "nginx", Options{UserMode: false})
	}
	os.Exit(retCode)
}
func TestMain ( m * testing . M ) { curUser , err := user . Current ( ) if err != nil { fmt . Println ( " " ) } userString = curUser . Username fmt . Printf ( " \n " , userString ) fmt . Println ( " " ) retCode := m . Run ( ) if userString == " " || userString == " " { ctx , cancel := context . WithTimeout ( context . Background ( ) , 10 * time . Second ) defer cancel ( ) Restart ( ctx , " " , Options { UserMode : false } ) } os . Exit ( retCode ) }
Testing assumptions
 there's no unit installed named `nonexistant`
 the syncthing unit to be available on the tester's system.
Testing assumptions there ' s no unit installed named ` nonexistant ` the syncthing unit to be available on the tester ' s system .