(t *testing.T, pluginName string)
| 60 | } |
| 61 | |
| 62 | func mockSubprocessCLIPlugin(t *testing.T, pluginName string) *SubprocessPluginRuntime { |
| 63 | t.Helper() |
| 64 | |
| 65 | rc := RuntimeConfigSubprocess{ |
| 66 | PlatformCommand: []PlatformCommand{ |
| 67 | {OperatingSystem: "darwin", Architecture: "", Command: "sh", Args: []string{"-c", "echo \"mock plugin\""}}, |
| 68 | {OperatingSystem: "linux", Architecture: "", Command: "sh", Args: []string{"-c", "echo \"mock plugin\""}}, |
| 69 | {OperatingSystem: "windows", Architecture: "", Command: "pwsh", Args: []string{"-c", "echo \"mock plugin\""}}, |
| 70 | }, |
| 71 | PlatformHooks: map[string][]PlatformCommand{ |
| 72 | Install: { |
| 73 | {OperatingSystem: "darwin", Architecture: "", Command: "sh", Args: []string{"-c", "echo \"installing...\""}}, |
| 74 | {OperatingSystem: "linux", Architecture: "", Command: "sh", Args: []string{"-c", "echo \"installing...\""}}, |
| 75 | {OperatingSystem: "windows", Architecture: "", Command: "pwsh", Args: []string{"-c", "echo \"installing...\""}}, |
| 76 | }, |
| 77 | }, |
| 78 | } |
| 79 | |
| 80 | pluginDir := t.TempDir() |
| 81 | |
| 82 | return &SubprocessPluginRuntime{ |
| 83 | metadata: Metadata{ |
| 84 | Name: pluginName, |
| 85 | Version: "0.1.2", |
| 86 | Type: "cli/v1", |
| 87 | APIVersion: "v1", |
| 88 | Runtime: "subprocess", |
| 89 | Config: &schema.ConfigCLIV1{ |
| 90 | Usage: "Mock plugin", |
| 91 | ShortHelp: "Mock plugin", |
| 92 | LongHelp: "Mock plugin for testing", |
| 93 | IgnoreFlags: false, |
| 94 | }, |
| 95 | RuntimeConfig: &rc, |
| 96 | }, |
| 97 | pluginDir: pluginDir, // NOTE: dir is empty (ie. plugin.yaml is not present) |
| 98 | RuntimeConfig: rc, |
| 99 | } |
| 100 | } |
no test coverage detected
searching dependent graphs…