Skip to content

Commit

Permalink
Fix the mixin install target
Browse files Browse the repository at this point in the history
I was accidentally copying the mixin runtime binary into the wrong
directory under PORTER_HOME.

Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs committed Jan 31, 2022
1 parent 79ee7c3 commit c3a1333
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mage/mixins/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (m Magefile) Install() {

os.MkdirAll(filepath.Join(porterHome, "mixins", m.MixinName, "runtimes"), 0700)
mgx.Must(shx.Copy(filepath.Join(m.BinDir, m.MixinName+xplat.FileExt()), filepath.Join(porterHome, "mixins", m.MixinName)))
mgx.Must(shx.Copy(filepath.Join(m.BinDir, "runtimes", m.MixinName+"-runtime"+xplat.FileExt()), filepath.Join(porterHome, "mixins/runtimes")))
mgx.Must(shx.Copy(filepath.Join(m.BinDir, "runtimes", m.MixinName+"-runtime"+xplat.FileExt()), filepath.Join(porterHome, "mixins", m.MixinName, "runtimes")))
}

// Remove generated build files
Expand Down
23 changes: 23 additions & 0 deletions mage/mixins/magefile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mixins

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
)

func TestInstall(t *testing.T) {
magefile := NewMagefile("github.com/mymixin/test-mixin", "testmixin", "testdata/bin/mixins/testmixin")

// Change the porter home to a safe place for the test to write to
os.Setenv("PORTER_HOME", "testdata/porter_home")
defer os.Unsetenv("PORTER_HOME")

magefile.Install()

assert.DirExists(t, "testdata/porter_home/mixins/testmixin", "The mixin directory doesn't exist")
assert.FileExists(t, "testdata/porter_home/mixins/testmixin/testmixin", "The client wasn't installed")
assert.DirExists(t, "testdata/porter_home/mixins/testmixin/runtimes", "The mixin runtimes directory doesn't exist")
assert.FileExists(t, "testdata/porter_home/mixins/testmixin/runtimes/testmixin-runtime", "The runtime wasn't installed")
}
1 change: 1 addition & 0 deletions mage/mixins/testdata/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
porter_home
Empty file.
Empty file.

0 comments on commit c3a1333

Please sign in to comment.