Esempio n. 1
0
func (m *mockEmpire) Deploy(ctx context.Context, opts empire.DeployOpts) (*empire.Release, error) {
	w := opts.Output
	if err := dockerutil.FakePull(image.Image{Repository: "remind101/acme-inc", Tag: "latest"}, w); err != nil {
		panic(err)
	}
	opts.Output = nil
	args := m.Called(opts)
	return nil, args.Error(0)
}
Esempio n. 2
0
// Returns a function that can be used as a Procfile extract for Empire. It
// writes a fake Docker pull to w, and extracts the given Procfile in yaml
// format.
func ExtractProcfile(pf procfile.Procfile) empire.ProcfileExtractor {
	if pf == nil {
		pf = defaultProcfile
	}

	return empire.ProcfileExtractorFunc(func(ctx context.Context, img image.Image, w io.Writer) ([]byte, error) {
		p, err := procfile.Marshal(pf)
		if err != nil {
			return nil, err
		}

		return p, dockerutil.FakePull(img, w)
	})
}
Esempio n. 3
0
// ExtractProcfile extracts a fake procfile.
func ExtractProcfile(ctx context.Context, img image.Image, w io.Writer) (procfile.Procfile, error) {
	return procfile.Procfile{
		"web": "./bin/web",
	}, dockerutil.FakePull(img, w)
}