get.porter.sh/porter@v1.3.0/pkg/plugins/helpers.go (about)

     1  package plugins
     2  
     3  import (
     4  	"get.porter.sh/porter/pkg/pkgmgmt"
     5  	"get.porter.sh/porter/pkg/pkgmgmt/client"
     6  )
     7  
     8  // NewTestPluginProvider helps us test Porter.Plugins in our unit tests without actually hitting any real plugins on the file system.
     9  func NewTestPluginProvider() *client.TestPackageManager {
    10  	v := pkgmgmt.VersionInfo{
    11  		Version: "v1.0",
    12  		Commit:  "abc123",
    13  		Author:  "Porter Authors",
    14  	}
    15  	impl := []Implementation{
    16  		{Type: "storage", Name: "blob"},
    17  		{Type: "storage", Name: "mongo"},
    18  	}
    19  	return &client.TestPackageManager{
    20  		PkgType: "plugins",
    21  		Packages: []pkgmgmt.PackageMetadata{
    22  			&Metadata{Metadata: pkgmgmt.Metadata{Name: "plugin1", VersionInfo: v}, Implementations: impl},
    23  			&Metadata{Metadata: pkgmgmt.Metadata{Name: "plugin2", VersionInfo: v}, Implementations: impl},
    24  			&Metadata{Metadata: pkgmgmt.Metadata{Name: "unknown", VersionInfo: v}},
    25  		},
    26  	}
    27  }