diff --git a/installer.go b/installer.go index a22dc1d..fe77483 100644 --- a/installer.go +++ b/installer.go @@ -26,6 +26,10 @@ func NewInstaller() *Installer { } } +func (i *Installer) SetLogger(logger *log.Logger) { + i.logger = logger +} + func (i *Installer) Ensure(ctx context.Context, sources []src.Source) (string, error) { var errs *multierror.Error diff --git a/installer_test.go b/installer_test.go index 3c1b2ca..5c14485 100644 --- a/installer_test.go +++ b/installer_test.go @@ -18,7 +18,9 @@ func TestInstaller_Ensure(t *testing.T) { // also works and continues working i := NewInstaller() - _, err := i.Ensure(context.Background(), []src.Source{ + i.SetLogger(testutil.TestLogger()) + ctx := context.Background() + _, err := i.Ensure(ctx, []src.Source{ &releases.LatestVersion{ Product: product.Terraform, }, @@ -26,4 +28,8 @@ func TestInstaller_Ensure(t *testing.T) { if err != nil { t.Fatal(err) } + err = i.Remove(ctx) + if err != nil { + t.Fatal(err) + } }