github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/pkg/pack/pack_test.go (about)

     1  package pack_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"path/filepath"
     7  	"testing"
     8  
     9  	"github.com/tooploox/oya/pkg/repo"
    10  	"github.com/tooploox/oya/pkg/semver"
    11  	tu "github.com/tooploox/oya/testutil"
    12  )
    13  
    14  func TestPack_Vendor(t *testing.T) {
    15  	installDir, err := ioutil.TempDir("", "oya")
    16  	tu.AssertNoErr(t, err, "Error creating temp dir")
    17  	defer os.RemoveAll(installDir)
    18  	l, err := repo.Open("github.com/tooploox/oya-fixtures")
    19  	tu.AssertNoErr(t, err, "Error opening pack library")
    20  	p, err := l.Version(semver.MustParse("v1.0.0"))
    21  	tu.AssertNoErr(t, err, "Error getting pack")
    22  	err = p.Install(installDir)
    23  	tu.AssertNoErr(t, err, "Error vendoring pack")
    24  	tu.AssertPathExists(t, filepath.Join(installDir, "github.com/tooploox/oya-fixtures@v1.0.0/Oyafile"))
    25  }