Exemple #1
0
func (cnt *Img) Test() {
	cnt.Install()
	log.Info("Testing " + cnt.manifest.NameAndVersion)

	if _, err := os.Stat(cnt.path + PATH_TESTS); err != nil {
		if cnt.args.NoTestFail {
			panic("Test directory does not exists but tests are mandatory")
		}
		log.Warn("Tests directory does not exists")
		return
	}

	cnt.importAciBats()

	testAci, err := cnt.prepareTestAci()
	if err != nil {
		panic(err)
	}
	testAci.Build()

	os.MkdirAll(cnt.target+PATH_TESTS+PATH_TARGET+PATH_RESULT, 0777)

	if err := utils.ExecCmd("rkt",
		"--insecure-skip-verify=true",
		"run",
		"--mds-register=false",
		"--no-overlay=true",
		"--volume=result,kind=host,source="+cnt.target+PATH_TESTS+PATH_TARGET+PATH_RESULT,
		cnt.target+PATH_TESTS+PATH_TARGET+"/image.aci"); err != nil {
		// rkt+systemd cannot exit with fail status yet
		panic(err)
	}

	cnt.checkResult()
}
Exemple #2
0
func (cnt *Img) checkLatestVersions(checked *chan bool) {
	if cnt.manifest.From != "" {
		version, _ := cnt.manifest.From.LatestVersion()
		log.Debug("latest version of from : " + cnt.manifest.NameAndVersion.Name() + ":" + version)
		if version != "" && utils.Version(cnt.manifest.From.Version()).LessThan(utils.Version(version)) {
			log.Warn("---------------------------------")
			log.Warn("From has newer version : " + cnt.manifest.From.Name() + ":" + version)
			log.Warn("---------------------------------")
		}
	}
	for _, dep := range cnt.manifest.Aci.Dependencies {
		version, _ := dep.LatestVersion()
		if version != "" && utils.Version(dep.Version()).LessThan(utils.Version(version)) {
			log.Warn("---------------------------------")
			log.Warn("Newer dependency version : " + dep.Name() + ":" + version)
			log.Warn("---------------------------------")
		}
	}
	if checked != nil {
		*checked <- true
	}
}