forked from canopy-network/canopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller_test.go
More file actions
33 lines (27 loc) · 763 Bytes
/
Copy pathcontroller_test.go
File metadata and controls
33 lines (27 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package controller
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func TestResolvePluginCtlPath(t *testing.T) {
wd, err := os.Getwd()
require.NoError(t, err)
tempDir := t.TempDir()
require.NoError(t, os.Chdir(tempDir))
t.Cleanup(func() {
require.NoError(t, os.Chdir(wd))
})
path, err := resolvePluginCtlPath("go")
require.NoError(t, err)
require.True(t, filepath.IsAbs(path))
require.FileExists(t, path)
require.Equal(t, "pluginctl.sh", filepath.Base(path))
require.Equal(t, "go", filepath.Base(filepath.Dir(path)))
}
func TestResolvePluginCtlPathMissing(t *testing.T) {
_, err := resolvePluginCtlPath("missing-plugin")
require.Error(t, err)
require.ErrorContains(t, err, "plugin launcher not found")
}