github.com/LukasHeimann/cloudfoundrycli/v8@v8.4.4/integration/shared/plugin/install_plugin_command_unix_test.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package plugin
     5  
     6  import (
     7  	"os"
     8  	"path/filepath"
     9  
    10  	"github.com/LukasHeimann/cloudfoundrycli/v8/integration/helpers"
    11  	. "github.com/onsi/ginkgo"
    12  	. "github.com/onsi/gomega"
    13  	. "github.com/onsi/gomega/gexec"
    14  )
    15  
    16  var _ = Describe("install-plugin command", func() {
    17  	Context("installing a plugin from a local file", func() {
    18  		var pluginPath string
    19  
    20  		BeforeEach(func() {
    21  			pluginPath = helpers.BuildConfigurablePlugin("configurable_plugin", "some-plugin", "1.0.0",
    22  				[]helpers.PluginCommand{
    23  					{Name: "some-command", Help: "some-command-help"},
    24  				},
    25  			)
    26  		})
    27  
    28  		When("the -f flag is given", func() {
    29  			It("sets the installed plugin's permissions to 0755", func() {
    30  				session := helpers.CF("install-plugin", pluginPath, "-f")
    31  				Eventually(session).Should(Exit(0))
    32  
    33  				installedPath := filepath.Join(homeDir, ".cf", "plugins", "some-plugin")
    34  				stat, err := os.Stat(installedPath)
    35  				Expect(err).ToNot(HaveOccurred())
    36  				Expect(stat.Mode()).To(Equal(os.FileMode(0755)))
    37  			})
    38  		})
    39  	})
    40  })