func Setup() (err error) {
	if _, err = runCompose("up", "-d"); err != nil {
		return
	}
	defer func() {
		if err != nil {
			_ = Teardown()
		}
	}()
	if _, err = getServices(); err != nil {
		return
	}
	_, err = checkServices()
	return
}
Setup setup UT related environment dependence for everything.
package lich
import (
	"bytes"
	"crypto/md5"
	"encoding/json"
	"flag"
	"fmt"
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"time"
)
var (
	retry    int
	noDown   bool
	yamlPath string
	pathHash string
	services map[string]*Container
)
func init() {
	flag.StringVar(&yamlPath, "f", "docker-compose.yaml", "composer yaml path.")
	flag.BoolVar(&noDown, "nodown", false, "containers are not recycled.")
}
func runCompose(args ...string) (output []byte, err error) {
	if _, err = os.Stat(yamlPath); os.IsNotExist(err) {
		log.Fatalf("os.Stat(%s) composer yaml is not exist!", yamlPath)
		return
	}
	if yamlPath, err = filepath.Abs(yamlPath); err != nil {
		log.Fatalf("filepath.Abs(%s) error(%v)", yamlPath, err)
		return
	}
	pathHash = fmt.Sprintf("%x", md5.Sum([]byte(yamlPath)))[:9]
	args = append([]string{"-f", yamlPath, "-p", pathHash}, args...)
	if output, err = exec.Command("docker-compose", args...).CombinedOutput(); err != nil {
		log.Fatalf("exec.Command(docker-compose) args(%v) stdout(%s) error(%v)", args, string(output), err)
		return
	}
	return
}