Skip to content

Commit

Permalink
Add documentation for test plugin command (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanchajanya authored Apr 7, 2023
1 parent 88d7101 commit 668bad4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/full/cli-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ Execute the test plugin:
tanzu test plugin <name>
```

For more details go to [Plugin Development Guide](../plugindev/README.md).

## Docs

Every plugin requires a README.md file at the top level of its directory which is enforced by the compiler. This file should serve as a guide for how the plugin is to be used.
Expand Down
38 changes: 37 additions & 1 deletion docs/plugindev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ newly created `main` package to implement the functionality of your new plugin.
You will notice in the generated `main.go` file, that CLI plugins have to instantiate a
[Plugin Descriptor](https://github.com/vmware-tanzu/tanzu-plugin-runtime/blob/main/plugin/types.go#L60)

```go
``` go
import (
"github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo"
"github.com/vmware-tanzu/tanzu-plugin-runtime/plugin"
Expand Down Expand Up @@ -259,6 +259,42 @@ Note: as the configuration variable implies, the
plugin development and testing only. The use of this setting in the production setting
is not supported.

### Testing the plugins

Plugin tests can be run by installing the admin `test` plugin.
Currently, we only support testing plugins built locally.

**Note:** The `test` admin functionality has been deprecated and no future enhancements are planned for this plugin.

Steps to test plugin :-

1. Bootstrap a new plugin
2. Build a plugin binary
3. Run below command

``` go
tanzu test fetch -l ~/${PLUGIN_NAME}/artifacts/plugins/${HOSTOS}/${HOSTARCH}
tanzu test plugin PLUGIN_NAME
```

Example: `helloworld` plugin

``` go
tanzu test fetch -l ~/helloworld/artifacts/plugins/darwin/amd64

[i] Installing plugin 'helloworld:v0.0.1' with target 'global'
[i] Installing test plugin for 'helloworld:v0.0.1'

❯ tanzu test plugin helloworld
---
[i] testing helloworld


[i] cleaning up

[ok] ok: successfully tested helloworld
```

------------------------------

## CLI command best practices
Expand Down

0 comments on commit 668bad4

Please sign in to comment.