(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func TestListPluginsIsSorted(t *testing.T) { |
| 136 | dir := fs.NewDir(t, t.Name(), |
| 137 | fs.WithFile("docker-bbb", ` |
| 138 | #!/bin/sh |
| 139 | echo '{"SchemaVersion":"0.1.0"}'`, fs.WithMode(0o777)), |
| 140 | fs.WithFile("docker-aaa", ` |
| 141 | #!/bin/sh |
| 142 | echo '{"SchemaVersion":"0.1.0"}'`, fs.WithMode(0o777)), |
| 143 | ) |
| 144 | defer dir.Remove() |
| 145 | |
| 146 | cli := test.NewFakeCli(nil) |
| 147 | cli.SetConfigFile(&configfile.ConfigFile{CLIPluginsExtraDirs: []string{dir.Path()}}) |
| 148 | |
| 149 | plugins, err := ListPlugins(cli, &cobra.Command{}) |
| 150 | assert.NilError(t, err) |
| 151 | |
| 152 | // We're only interested in the plugins we created for testing this, and only |
| 153 | // if they appear in the expected order |
| 154 | var names []string |
| 155 | for _, p := range plugins { |
| 156 | if p.Name == "aaa" || p.Name == "bbb" { |
| 157 | names = append(names, p.Name) |
| 158 | } |
| 159 | } |
| 160 | assert.DeepEqual(t, names, []string{"aaa", "bbb"}) |
| 161 | } |
| 162 | |
| 163 | func TestErrPluginNotFound(t *testing.T) { |
| 164 | var err error = errPluginNotFound("test") |
nothing calls this directly
no test coverage detected
searching dependent graphs…