Example #1
0
func (h *Harness) MakeEmptyRoot() {
	var err error
	prefix := fmt.Sprintf("%s-", testname.Get("parse-cli-"))
	h.Env.Root, err = ioutil.TempDir("", prefix)
	ensure.Nil(h.T, err)
	h.remove = append(h.remove, h.Env.Root)
}
Example #2
0
// makes a temp directory with the given global config.
func makeDirWithConfig(t testing.TB, global string) string {
	dir, err := ioutil.TempDir("", testname.Get("parse-cli-"))
	ensure.Nil(t, err)
	ensure.Nil(t, os.Mkdir(filepath.Join(dir, "config"), 0755))
	ensure.Nil(t, ioutil.WriteFile(
		filepath.Join(dir, LegacyConfigFile),
		[]byte(global),
		os.FileMode(0600),
	))
	return dir
}
Example #3
0
// NewStartedServer creates a new server starts it.
func NewStartedServer(t Fatalf, args ...string) *Server {
	for {
		s := &Server{
			T:           t,
			StopTimeout: 15 * time.Second,
			testName:    testname.Get("MGO"),
		}
		start := make(chan struct{})
		go func() {
			defer close(start)
			s.Start(args...)
		}()
		select {
		case <-start:
			return s
		case <-time.After(30 * time.Second):
		}
	}
}
Example #4
0
func makeEmptyRoot(t *testing.T) string {
	prefix := fmt.Sprintf("%s-", testname.Get("parse-cli-"))
	root, err := ioutil.TempDir("", prefix)
	ensure.Nil(t, err)
	return root
}