gopkg.in/openshift/source-to-image.v1@v1.2.0/pkg/test/install.go (about) 1 package test 2 3 import ( 4 "github.com/openshift/source-to-image/pkg/api" 5 ) 6 7 // FakeInstaller provides a fake installer 8 type FakeInstaller struct { 9 Scripts [][]string 10 DstDir []string 11 Error error 12 } 13 14 func (f *FakeInstaller) run(scripts []string, dstDir string) []api.InstallResult { 15 result := []api.InstallResult{} 16 f.Scripts = append(f.Scripts, scripts) 17 f.DstDir = append(f.DstDir, dstDir) 18 return result 19 } 20 21 // InstallRequired downloads and installs required scripts into dstDir 22 func (f *FakeInstaller) InstallRequired(scripts []string, dstDir string) ([]api.InstallResult, error) { 23 return f.run(scripts, dstDir), f.Error 24 } 25 26 // InstallOptional downloads and installs optional scripts into dstDir 27 func (f *FakeInstaller) InstallOptional(scripts []string, dstDir string) []api.InstallResult { 28 return f.run(scripts, dstDir) 29 }