예제 #1
0
func setCurrentAsCorrect() {
	files := kmgFile.MustGetAllFiles("testFile")
	for _, file := range files {
		if filepath.Ext(file) != ".gotplhtml" {
			continue
		}
		kmgFile.MustCopyFile(filepath.Join(filepath.Dir(file), kmgFile.GetFileBaseWithoutExt(file)+".go"), filepath.Join(filepath.Dir(file), kmgFile.GetFileBaseWithoutExt(file)+".go.good"))
	}
}
예제 #2
0
파일: test.go 프로젝트: keysonZZZ/kmg
func main() {
	kmgCmd.MustRun(`kmg GoCrossCompile -platform linux_amd64 github.com/bronze1man/kmg/kmg`)
	kmgCmd.MustRun(`kmg GoCrossCompile -platform linux_amd64 github.com/bronze1man/kmg/kmg/SubCommand/serviceCmd/testBin`)
	kmgFile.MustCopyFile(filepath.Join(kmgConfig.DefaultEnv().ProjectPath, "bin/kmg_linux_amd64"), filepath.Join(dockerPath, "kmg"))
	kmgFile.MustCopyFile(filepath.Join(kmgConfig.DefaultEnv().ProjectPath, "bin/testBin_linux_amd64"), filepath.Join(dockerPath, "testBin"))
	kmgFile.MustWriteFile(filepath.Join(dockerPath, "Dockerfile"), []byte(`FROM ubuntu
WORKDIR /
COPY kmg /bin/
COPY testBin /bin/
RUN chmod +x /bin/kmg
RUN chmod +x /bin/testBin
CMD testBin
`))
	//CMD kmg service setandrestart t testBin && kmg service stop t && kmg service start t && kmg service restart t
	kmgCmd.MustRunAndReturnOutput("docker build -t kmgtest " + dockerPath)
	for i := 0; i < 20; i++ {
		time.Sleep(time.Second)
		kmgCmd.MustRunAndReturnOutput("docker run kmgtest")
	}
}