From 887476dbf54a7ca019070e5a0a4cfa35d4fd9c96 Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Mon, 18 Jul 2016 09:32:42 -0700 Subject: [PATCH] Rename snap plugin to match existing convention. All plugins have been renamed from snap-* to snap-plugin-* to match existing plugin conventions. --- README.md | 12 +++--- control/control_grpc_server_test.go | 4 +- control/control_test.go | 20 ++++----- control/fixtures/fixtures.go | 4 +- core/plugin_test.go | 4 +- docs/PLUGIN_AUTHORING.md | 2 +- docs/PLUGIN_SIGNING.md | 41 ++++++++++--------- docs/SNAPCTL.md | 6 +-- mgmt/rest/client/client_func_test.go | 6 +-- mgmt/rest/rest_func_test.go | 6 +-- pkg/psigning/psigning_test.go | 4 +- ...ctor-mock1 => snap-plugin-collector-mock1} | 0 ...k1.asc => snap-plugin-collector-mock1.asc} | 0 .../README.md | 0 .../main.go | 2 +- .../main_small_test.go | 0 .../main_test.go | 2 +- .../mock/mock.go | 0 .../mock/mock_medium_test.go | 0 .../README.md | 0 .../main.go | 2 +- .../main_small_test.go | 0 .../main_test.go | 2 +- .../mock/mock.go | 0 .../main.go | 2 +- .../main_small_test.go | 0 .../passthru/passthru.go | 0 .../README.md | 0 .../file/file.go | 0 .../file/file_small_test.go | 0 .../main.go | 2 +- .../main_small_test.go | 0 .../main_test.go | 2 +- scheduler/distributed_task_test.go | 12 +++--- scheduler/workflow_test.go | 8 ++-- scripts/test.sh | 8 ++-- 36 files changed, 76 insertions(+), 75 deletions(-) rename pkg/psigning/{snap-collector-mock1 => snap-plugin-collector-mock1} (100%) rename pkg/psigning/{snap-collector-mock1.asc => snap-plugin-collector-mock1.asc} (100%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/README.md (100%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/main.go (92%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/main_small_test.go (100%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/main_test.go (97%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/mock/mock.go (100%) rename plugin/collector/{snap-collector-mock1 => snap-plugin-collector-mock1}/mock/mock_medium_test.go (100%) rename plugin/collector/{snap-collector-mock2 => snap-plugin-collector-mock2}/README.md (100%) rename plugin/collector/{snap-collector-mock2 => snap-plugin-collector-mock2}/main.go (93%) rename plugin/collector/{snap-collector-mock2 => snap-plugin-collector-mock2}/main_small_test.go (100%) rename plugin/collector/{snap-collector-mock2 => snap-plugin-collector-mock2}/main_test.go (97%) rename plugin/collector/{snap-collector-mock2 => snap-plugin-collector-mock2}/mock/mock.go (100%) rename plugin/processor/{snap-processor-passthru => snap-plugin-processor-passthru}/main.go (90%) rename plugin/processor/{snap-processor-passthru => snap-plugin-processor-passthru}/main_small_test.go (100%) rename plugin/processor/{snap-processor-passthru => snap-plugin-processor-passthru}/passthru/passthru.go (100%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/README.md (100%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/file/file.go (100%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/file/file_small_test.go (100%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/main.go (90%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/main_small_test.go (100%) rename plugin/publisher/{snap-publisher-mock-file => snap-plugin-publisher-mock-file}/main_test.go (96%) diff --git a/README.md b/README.md index 8273f478b..6026e67a7 100644 --- a/README.md +++ b/README.md @@ -130,17 +130,17 @@ Next, load the plugins. This can be achieved through the REST API directly or by Using the API directly with cURL: ``` $ cd ~/snap/plugins/ -$ curl -X POST -F plugin=@snap-collector-mock1 http://localhost:8181/v1/plugins -$ curl -X POST -F plugin=@snap-processor-passthru http://localhost:8181/v1/plugins -$ curl -X POST -F plugin=@snap-publisher-file http://localhost:8181/v1/plugins +$ curl -X POST -F plugin=@snap-plugin-collector-mock1 http://localhost:8181/v1/plugins +$ curl -X POST -F plugin=@snap-plugin-processor-passthru http://localhost:8181/v1/plugins +$ curl -X POST -F plugin=@snap-plugin-publisher-file http://localhost:8181/v1/plugins ``` Every interaction with `snapd` can be done through the REST API. To see what else you can do with the API, view our [API Documentation](docs/REST_API.md). We will continue on using `snapctl`: ``` $ cd ~/snap/plugins/ -$ snapctl plugin load snap-collector-mock1 -$ snapctl plugin load snap-processor-passthru -$ snapctl plugin load snap-publisher-file +$ snapctl plugin load snap-plugin-collector-mock1 +$ snapctl plugin load snap-plugin-processor-passthru +$ snapctl plugin load snap-plugin-publisher-file ``` Let's look at what plugins you have loaded now: diff --git a/control/control_grpc_server_test.go b/control/control_grpc_server_test.go index ddedf46c8..750029815 100644 --- a/control/control_grpc_server_test.go +++ b/control/control_grpc_server_test.go @@ -70,12 +70,12 @@ func TestGRPCServerScheduler(t *testing.T) { log.Fatal(err) } c.Load(mock) - passthru, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-processor-passthru")) + passthru, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-plugin-processor-passthru")) if err != nil { log.Fatal(err) } c.Load(passthru) - filepub, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-publisher-mock-file")) + filepub, err := core.NewRequestedPlugin(path.Join(fixtures.SnapPath, "plugin", "snap-plugin-publisher-mock-file")) if err != nil { log.Fatal(err) } diff --git a/control/control_test.go b/control/control_test.go index c16cbdb52..e0963ba94 100644 --- a/control/control_test.go +++ b/control/control_test.go @@ -177,7 +177,7 @@ func TestSwapPlugin(t *testing.T) { So(c.PluginCatalog()[0].Name(), ShouldEqual, "mock") }) }) - mock1Path := strings.Replace(fixtures.PluginPath, "snap-collector-mock2", "snap-collector-mock1", 1) + mock1Path := strings.Replace(fixtures.PluginPath, "snap-plugin-collector-mock2", "snap-plugin-collector-mock1", 1) mockRP, mErr := core.NewRequestedPlugin(mock1Path) Convey("Loading a plugin should not error", t, func() { So(mErr, ShouldBeNil) @@ -224,7 +224,7 @@ func TestSwapPlugin(t *testing.T) { }) }) - filePath := strings.Replace(fixtures.PluginPath, "snap-collector-mock2", "snap-publisher-mock-file", 1) + filePath := strings.Replace(fixtures.PluginPath, "snap-plugin-collector-mock2", "snap-plugin-publisher-mock-file", 1) fileRP, pErr := core.NewRequestedPlugin(filePath) Convey("Loading a plugin should not error", t, func() { So(pErr, ShouldBeNil) @@ -1479,7 +1479,7 @@ func TestPublishMetrics(t *testing.T) { time.Sleep(1 * time.Second) // Load plugin - _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-publisher-mock-file")) + _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-publisher-mock-file")) So(err, ShouldBeNil) <-lpe.done So(len(c.pluginManager.all()), ShouldEqual, 1) @@ -1533,7 +1533,7 @@ func TestProcessMetrics(t *testing.T) { c.Config.Plugins.Processor.Plugins["passthru"] = newPluginConfigItem(optAddPluginConfigItem("test", ctypes.ConfigValueBool{Value: true})) // Load plugin - _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-processor-passthru")) + _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-processor-passthru")) So(err, ShouldBeNil) <-lpe.done So(len(c.pluginManager.all()), ShouldEqual, 1) @@ -1612,7 +1612,7 @@ func TestMetricSubscriptionToNewVersion(t *testing.T) { lpe := newListenToPluginSubscriptionEvent() c.eventManager.RegisterHandler("TestMetricSubscriptionToNewVersion", lpe) c.Start() - _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-collector-mock1")) + _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1")) So(err, ShouldBeNil) So(len(c.pluginManager.all()), ShouldEqual, 1) lp, err2 := c.pluginManager.get("collector:mock:1") @@ -1635,8 +1635,8 @@ func TestMetricSubscriptionToNewVersion(t *testing.T) { _, ok := mts[0].Data().(string) So(ok, ShouldEqual, true) Convey("Loading v2 of that plugin should move subscriptions to newer version", func() { - // Load version snap-collector-mock2 - _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-collector-mock2")) + // Load version snap-plugin-collector-mock2 + _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2")) So(err, ShouldBeNil) select { // Wait on subscriptionMovedEvent @@ -1675,7 +1675,7 @@ func TestMetricSubscriptionToOlderVersion(t *testing.T) { lpe := newListenToPluginSubscriptionEvent() c.eventManager.RegisterHandler("TestMetricSubscriptionToOlderVersion", lpe) c.Start() - _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-collector-mock2")) + _, err := load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock2")) So(err, ShouldBeNil) So(len(c.pluginManager.all()), ShouldEqual, 1) lp, err2 := c.pluginManager.get("collector:mock:2") @@ -1700,8 +1700,8 @@ func TestMetricSubscriptionToOlderVersion(t *testing.T) { pc := c.PluginCatalog() mockv2 := pc[0] Convey("Loading v1 of that plugin and unloading v2 should move subscriptions to older version", func() { - // Load version snap-collector-mock2 - _, err = load(c, path.Join(fixtures.SnapPath, "plugin", "snap-collector-mock1")) + // Load version snap-plugin-collector-mock2 + _, err = load(c, path.Join(fixtures.SnapPath, "plugin", "snap-plugin-collector-mock1")) So(err, ShouldBeNil) _, err = c.Unload(mockv2) So(err, ShouldBeNil) diff --git a/control/fixtures/fixtures.go b/control/fixtures/fixtures.go index 25899e669..9b6bca978 100644 --- a/control/fixtures/fixtures.go +++ b/control/fixtures/fixtures.go @@ -31,11 +31,11 @@ import ( ) var ( - PluginName = "snap-collector-mock2" + PluginName = "snap-plugin-collector-mock2" SnapPath = os.Getenv("SNAP_PATH") PluginPath = path.Join(SnapPath, "plugin", PluginName) - JSONRPCPluginName = "snap-collector-mock1" + JSONRPCPluginName = "snap-plugin-collector-mock1" JSONRPCPluginPath = path.Join(SnapPath, "plugin", JSONRPCPluginName) ) diff --git a/core/plugin_test.go b/core/plugin_test.go index f906fd028..68d11065f 100644 --- a/core/plugin_test.go +++ b/core/plugin_test.go @@ -32,10 +32,10 @@ import ( ) var ( - PluginName = "snap-collector-mock1" + PluginName = "snap-plugin-collector-mock1" SnapPath = os.Getenv("SNAP_PATH") PluginPath = path.Join(SnapPath, "plugin", PluginName) - SignatureFile = path.Join(SnapPath, "../pkg/psigning", "snap-collector-mock1.asc") + SignatureFile = path.Join(SnapPath, "../pkg/psigning", "snap-plugin-collector-mock1.asc") ) func TestRequestedPlugin(t *testing.T) { diff --git a/docs/PLUGIN_AUTHORING.md b/docs/PLUGIN_AUTHORING.md index 2b652aff4..132c9f53f 100644 --- a/docs/PLUGIN_AUTHORING.md +++ b/docs/PLUGIN_AUTHORING.md @@ -119,7 +119,7 @@ GetConfigPolicy() (*cpolicy.ConfigPolicy, error) Publish(contentType string, content []byte, config map[string]ctypes.ConfigValue) error ``` ### Exposing a plugin -Creating the main program to serve the newly written plugin as an external process in main.go. By defining "Plugin.PluginMeta" with plugin specific settings, the newly created plugin may have its setting to override Snap global settings. Please refer to [a sample](https://github.com/intelsdi-x/snap/blob/master/plugin/collector/snap-collector-mock1/main.go) to see how main.go is written. You may browse [snap global settings](https://github.com/intelsdi-x/snap/blob/master/snapd.go#L45-L119). +Creating the main program to serve the newly written plugin as an external process in main.go. By defining "Plugin.PluginMeta" with plugin specific settings, the newly created plugin may have its setting to override Snap global settings. Please refer to [a sample](https://github.com/intelsdi-x/snap/blob/master/plugin/collector/snap-plugin-collector-mock1/main.go) to see how main.go is written. You may browse [snap global settings](https://github.com/intelsdi-x/snap/blob/master/snapd.go#L45-L119). Building main.go generates a binary executable. You may choose to sign the executable with our [plugin signing](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_SIGNING.md). diff --git a/docs/PLUGIN_SIGNING.md b/docs/PLUGIN_SIGNING.md index 3f10e4f9d..1418ac297 100644 --- a/docs/PLUGIN_SIGNING.md +++ b/docs/PLUGIN_SIGNING.md @@ -71,7 +71,7 @@ INFO[0000] adding keyring file: /Users/tiffany/.gnupg/secring.gpg INFO[0000] adding keyring file: /Users/tiffany/.gnupg/trustdb.gpg ``` ``` -$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc +$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock1 -a build/plugin/snap-plugin-collector-mock1.asc Plugin loaded Name: mock Version: 1 @@ -81,51 +81,52 @@ Loaded Time: Thu, 12 Nov 2015 13:53:58 PST ``` ``` INFO[0036] API request _module=_mgmt-rest index=3 method=POST url=/v1/plugins -DEBU[0037] wrote 7332032 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-collector-mock1 -DEBU[0037] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/784063842/snap-collector-mock1.asc -INFO[0037] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-collector-mock1 _module=_mgmt-rest +DEBU[0037] wrote 7332032 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-plugin-collector-mock1 +DEBU[0037] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/784063842/snap-plugin-collector-mock1.asc +INFO[0037] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-plugin-collector-mock1 _module=_mgmt-rest Signature made Thu, 12 Nov 2015 13:53:58 PST using RSA key ID 43F744A0 Good signature from Tiffany Jernigan (Main signing key) ``` No signature ``` -$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock2 +$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock2 Error loading plugin: Signature file (.asc) not found: open : no such file or directory ``` ``` -DEBU[0033] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2 -INFO[0033] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2 _module=_mgmt-rest +DEBU[0033] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-plugin-collector-mock2 +INFO[0033] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-plugin-collector-mock2 _module=_mgmt-rest ERRO[0033] Signature file (.asc) not found: open : no such file or directory _module=_mgmt-rest -DEBU[0033] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2) _module=_mgmt-rest +DEBU[0033] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-plugin-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-plugin-collector-mock2) _module=_mgmt-rest ``` Invalid signature ``` -$SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock2 -a build/plugin/snap-collector-mock1.asc +$SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock2 -a build/plugin/snap-plugin-collector-mock1.asc Error loading plugin: Error checking signature openpgp: invalid signature: hash tag doesn't match ``` ``` -DEBU[0003] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2 -DEBU[0003] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-collector-mock1.asc -INFO[0003] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2 _module=_mgmt-rest +DEBU[0003] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-plugin-collector-mock2 +DEBU[0003] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-plugin-collector-mock1.asc +INFO[0003] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-plugin-collector-mock2 _module=_mgmt-rest ERRO[0003] Error checking signature openpgp: invalid signature: hash tag doesn't match _module=_mgmt-rest -DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) _module=_mgmt-rest -DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-collector-mock1.asc) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) _module=_mgmt-rest +DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-plugin-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-plugin-collector-mock2) _module=_mgmt-rest +DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-plugin-collector-mock1.asc) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-plugin-collector-mock2) _module=_mgmt-rest ``` Wrong keyring ``` -$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc +$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock1 -a build/plugin/snap-plugin-collector-mock1.asc Error loading plugin: Error checking signature openpgp: signature made by unknown entity ``` ``` -INFO[0002] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/057449871/snap-collector-mock1 _module=_mgmt-rest +INFO[0002] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/057449871/snap-plugin-collector-mock1 _module=_mgmt-rest + ERRO[0002] Error checking signature openpgp: signature made by unknown entity _module=_mgmt-rest ``` @@ -136,7 +137,7 @@ INFO[0000] setting plugin trust level to: warning INFO[0000] adding keyring file /Users/tiffany/.gnupg/pubring.gpg ``` ``` -$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc +$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock1 -a build/plugin/snap-plugin-collector-mock1.asc Plugin loaded Name: mock @@ -145,7 +146,7 @@ Type: collector Signed: true Loaded Time: Thu, 12 Nov 2015 14:08:32 PST -$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-collector-mock2 +$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-plugin-collector-mock2 Plugin loaded Name: mock @@ -155,10 +156,10 @@ Signed: false Loaded Time: Thu, 12 Nov 2015 14:08:49 PST ``` ``` -INFO[0338] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/276797457/snap-collector-mock1 _module=_mgmt-rest +INFO[0338] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/276797457/snap-plugin-collector-mock1 _module=_mgmt-rest Signature made Thu, 12 Nov 2015 14:08:32 PST using RSA key ID 43F744A0 Good signature from Tiffany Jernigan (ACI signing key) -WARN[0355] Loading unsigned plugin /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/205904491/snap-collector-mock2 _block=load _module=control +WARN[0355] Loading unsigned plugin /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/205904491/snap-plugin-collector-mock2 _block=load _module=control ``` ##Creating Signing Files and Validating Signature diff --git a/docs/SNAPCTL.md b/docs/SNAPCTL.md index 63da2d49d..77297976d 100644 --- a/docs/SNAPCTL.md +++ b/docs/SNAPCTL.md @@ -117,9 +117,9 @@ $ $SNAP_PATH/bin/snapd -l 1 -t 0 ``` -$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-collector-mock1 -$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-processor-passthru -$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-publisher-mock-file +$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-plugin-collector-mock1 +$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-plugin-processor-passthru +$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-plugin-publisher-mock-file $ $SNAP_PATH/bin/snapctl plugin list $ $SNAP_PATH/bin/snapctl task create -t $SNAP_PATH/../examples/tasks/mock-file.json $ $SNAP_PATH/bin/snapctl task create -w $SNAP_PATH/../mgmt/rest/wmap_sample/1.json -i 1s -d 10s diff --git a/mgmt/rest/client/client_func_test.go b/mgmt/rest/client/client_func_test.go index 57eae69f8..d0c725d37 100644 --- a/mgmt/rest/client/client_func_test.go +++ b/mgmt/rest/client/client_func_test.go @@ -46,9 +46,9 @@ var ( LOG_LEVEL = log.FatalLevel SNAP_PATH = os.Getenv("SNAP_PATH") - MOCK_PLUGIN_PATH1 = []string{SNAP_PATH + "/plugin/snap-collector-mock1"} - MOCK_PLUGIN_PATH2 = []string{SNAP_PATH + "/plugin/snap-collector-mock2"} - FILE_PLUGIN_PATH = []string{SNAP_PATH + "/plugin/snap-publisher-mock-file"} + MOCK_PLUGIN_PATH1 = []string{SNAP_PATH + "/plugin/snap-plugin-collector-mock1"} + MOCK_PLUGIN_PATH2 = []string{SNAP_PATH + "/plugin/snap-plugin-collector-mock2"} + FILE_PLUGIN_PATH = []string{SNAP_PATH + "/plugin/snap-plugin-publisher-mock-file"} DIRECTORY_PATH = []string{SNAP_PATH + "/plugin/"} NextPort = 45000 diff --git a/mgmt/rest/rest_func_test.go b/mgmt/rest/rest_func_test.go index ed7878249..8f6cc1ee6 100644 --- a/mgmt/rest/rest_func_test.go +++ b/mgmt/rest/rest_func_test.go @@ -57,9 +57,9 @@ var ( SNAP_PATH = os.Getenv("SNAP_PATH") SNAP_AUTODISCOVER_PATH = os.Getenv("SNAP_AUTODISCOVER_PATH") - MOCK_PLUGIN_PATH1 = SNAP_PATH + "/plugin/snap-collector-mock1" - MOCK_PLUGIN_PATH2 = SNAP_PATH + "/plugin/snap-collector-mock2" - FILE_PLUGIN_PATH = SNAP_PATH + "/plugin/snap-publisher-mock-file" + MOCK_PLUGIN_PATH1 = SNAP_PATH + "/plugin/snap-plugin-collector-mock1" + MOCK_PLUGIN_PATH2 = SNAP_PATH + "/plugin/snap-plugin-collector-mock2" + FILE_PLUGIN_PATH = SNAP_PATH + "/plugin/snap-plugin-publisher-mock-file" CompressedUpload = true TotalUploadSize = 0 diff --git a/pkg/psigning/psigning_test.go b/pkg/psigning/psigning_test.go index b3152b18a..489135876 100644 --- a/pkg/psigning/psigning_test.go +++ b/pkg/psigning/psigning_test.go @@ -32,10 +32,10 @@ import ( func TestValidateSignature(t *testing.T) { keyringFile := []string{"pubring.gpg"} - signedFile := "snap-collector-mock1" + signedFile := "snap-plugin-collector-mock1" signatureFile := signedFile + ".asc" snapPath := os.Getenv("SNAP_PATH") - unsignedFile := path.Join(snapPath, "plugin", "snap-collector-mock2") + unsignedFile := path.Join(snapPath, "plugin", "snap-plugin-collector-mock2") s := SigningManager{} signature, _ := ioutil.ReadFile(signatureFile) diff --git a/pkg/psigning/snap-collector-mock1 b/pkg/psigning/snap-plugin-collector-mock1 similarity index 100% rename from pkg/psigning/snap-collector-mock1 rename to pkg/psigning/snap-plugin-collector-mock1 diff --git a/pkg/psigning/snap-collector-mock1.asc b/pkg/psigning/snap-plugin-collector-mock1.asc similarity index 100% rename from pkg/psigning/snap-collector-mock1.asc rename to pkg/psigning/snap-plugin-collector-mock1.asc diff --git a/plugin/collector/snap-collector-mock1/README.md b/plugin/collector/snap-plugin-collector-mock1/README.md similarity index 100% rename from plugin/collector/snap-collector-mock1/README.md rename to plugin/collector/snap-plugin-collector-mock1/README.md diff --git a/plugin/collector/snap-collector-mock1/main.go b/plugin/collector/snap-plugin-collector-mock1/main.go similarity index 92% rename from plugin/collector/snap-collector-mock1/main.go rename to plugin/collector/snap-plugin-collector-mock1/main.go index 8aa46a23a..e02841124 100644 --- a/plugin/collector/snap-collector-mock1/main.go +++ b/plugin/collector/snap-plugin-collector-mock1/main.go @@ -25,7 +25,7 @@ import ( // Import the snap plugin library "github.com/intelsdi-x/snap/control/plugin" // Import our collector plugin implementation - "github.com/intelsdi-x/snap/plugin/collector/snap-collector-mock1/mock" + "github.com/intelsdi-x/snap/plugin/collector/snap-plugin-collector-mock1/mock" ) func main() { diff --git a/plugin/collector/snap-collector-mock1/main_small_test.go b/plugin/collector/snap-plugin-collector-mock1/main_small_test.go similarity index 100% rename from plugin/collector/snap-collector-mock1/main_small_test.go rename to plugin/collector/snap-plugin-collector-mock1/main_small_test.go diff --git a/plugin/collector/snap-collector-mock1/main_test.go b/plugin/collector/snap-plugin-collector-mock1/main_test.go similarity index 97% rename from plugin/collector/snap-collector-mock1/main_test.go rename to plugin/collector/snap-plugin-collector-mock1/main_test.go index 9148653b3..24b9498d8 100644 --- a/plugin/collector/snap-collector-mock1/main_test.go +++ b/plugin/collector/snap-plugin-collector-mock1/main_test.go @@ -33,7 +33,7 @@ import ( ) var ( - PluginName = "snap-collector-mock1" + PluginName = "snap-plugin-collector-mock1" PluginType = "collector" SnapPath = os.Getenv("SNAP_PATH") PluginPath = path.Join(SnapPath, "plugin", PluginName) diff --git a/plugin/collector/snap-collector-mock1/mock/mock.go b/plugin/collector/snap-plugin-collector-mock1/mock/mock.go similarity index 100% rename from plugin/collector/snap-collector-mock1/mock/mock.go rename to plugin/collector/snap-plugin-collector-mock1/mock/mock.go diff --git a/plugin/collector/snap-collector-mock1/mock/mock_medium_test.go b/plugin/collector/snap-plugin-collector-mock1/mock/mock_medium_test.go similarity index 100% rename from plugin/collector/snap-collector-mock1/mock/mock_medium_test.go rename to plugin/collector/snap-plugin-collector-mock1/mock/mock_medium_test.go diff --git a/plugin/collector/snap-collector-mock2/README.md b/plugin/collector/snap-plugin-collector-mock2/README.md similarity index 100% rename from plugin/collector/snap-collector-mock2/README.md rename to plugin/collector/snap-plugin-collector-mock2/README.md diff --git a/plugin/collector/snap-collector-mock2/main.go b/plugin/collector/snap-plugin-collector-mock2/main.go similarity index 93% rename from plugin/collector/snap-collector-mock2/main.go rename to plugin/collector/snap-plugin-collector-mock2/main.go index 282f28937..a94676243 100644 --- a/plugin/collector/snap-collector-mock2/main.go +++ b/plugin/collector/snap-plugin-collector-mock2/main.go @@ -25,7 +25,7 @@ import ( // Import the snap plugin library "github.com/intelsdi-x/snap/control/plugin" // Import our collector plugin implementation - "github.com/intelsdi-x/snap/plugin/collector/snap-collector-mock2/mock" + "github.com/intelsdi-x/snap/plugin/collector/snap-plugin-collector-mock2/mock" ) func main() { diff --git a/plugin/collector/snap-collector-mock2/main_small_test.go b/plugin/collector/snap-plugin-collector-mock2/main_small_test.go similarity index 100% rename from plugin/collector/snap-collector-mock2/main_small_test.go rename to plugin/collector/snap-plugin-collector-mock2/main_small_test.go diff --git a/plugin/collector/snap-collector-mock2/main_test.go b/plugin/collector/snap-plugin-collector-mock2/main_test.go similarity index 97% rename from plugin/collector/snap-collector-mock2/main_test.go rename to plugin/collector/snap-plugin-collector-mock2/main_test.go index a97bd7bba..54c556313 100644 --- a/plugin/collector/snap-collector-mock2/main_test.go +++ b/plugin/collector/snap-plugin-collector-mock2/main_test.go @@ -33,7 +33,7 @@ import ( ) var ( - PluginName = "snap-collector-mock2" + PluginName = "snap-plugin-collector-mock2" PluginType = "collector" SnapPath = os.Getenv("SNAP_PATH") PluginPath = path.Join(SnapPath, "plugin", PluginName) diff --git a/plugin/collector/snap-collector-mock2/mock/mock.go b/plugin/collector/snap-plugin-collector-mock2/mock/mock.go similarity index 100% rename from plugin/collector/snap-collector-mock2/mock/mock.go rename to plugin/collector/snap-plugin-collector-mock2/mock/mock.go diff --git a/plugin/processor/snap-processor-passthru/main.go b/plugin/processor/snap-plugin-processor-passthru/main.go similarity index 90% rename from plugin/processor/snap-processor-passthru/main.go rename to plugin/processor/snap-plugin-processor-passthru/main.go index 475e16b05..92d22c43b 100644 --- a/plugin/processor/snap-processor-passthru/main.go +++ b/plugin/processor/snap-plugin-processor-passthru/main.go @@ -23,7 +23,7 @@ import ( "os" "github.com/intelsdi-x/snap/control/plugin" - "github.com/intelsdi-x/snap/plugin/processor/snap-processor-passthru/passthru" + "github.com/intelsdi-x/snap/plugin/processor/snap-plugin-processor-passthru/passthru" ) func main() { diff --git a/plugin/processor/snap-processor-passthru/main_small_test.go b/plugin/processor/snap-plugin-processor-passthru/main_small_test.go similarity index 100% rename from plugin/processor/snap-processor-passthru/main_small_test.go rename to plugin/processor/snap-plugin-processor-passthru/main_small_test.go diff --git a/plugin/processor/snap-processor-passthru/passthru/passthru.go b/plugin/processor/snap-plugin-processor-passthru/passthru/passthru.go similarity index 100% rename from plugin/processor/snap-processor-passthru/passthru/passthru.go rename to plugin/processor/snap-plugin-processor-passthru/passthru/passthru.go diff --git a/plugin/publisher/snap-publisher-mock-file/README.md b/plugin/publisher/snap-plugin-publisher-mock-file/README.md similarity index 100% rename from plugin/publisher/snap-publisher-mock-file/README.md rename to plugin/publisher/snap-plugin-publisher-mock-file/README.md diff --git a/plugin/publisher/snap-publisher-mock-file/file/file.go b/plugin/publisher/snap-plugin-publisher-mock-file/file/file.go similarity index 100% rename from plugin/publisher/snap-publisher-mock-file/file/file.go rename to plugin/publisher/snap-plugin-publisher-mock-file/file/file.go diff --git a/plugin/publisher/snap-publisher-mock-file/file/file_small_test.go b/plugin/publisher/snap-plugin-publisher-mock-file/file/file_small_test.go similarity index 100% rename from plugin/publisher/snap-publisher-mock-file/file/file_small_test.go rename to plugin/publisher/snap-plugin-publisher-mock-file/file/file_small_test.go diff --git a/plugin/publisher/snap-publisher-mock-file/main.go b/plugin/publisher/snap-plugin-publisher-mock-file/main.go similarity index 90% rename from plugin/publisher/snap-publisher-mock-file/main.go rename to plugin/publisher/snap-plugin-publisher-mock-file/main.go index 54437c088..74c382e31 100644 --- a/plugin/publisher/snap-publisher-mock-file/main.go +++ b/plugin/publisher/snap-plugin-publisher-mock-file/main.go @@ -23,7 +23,7 @@ import ( "os" "github.com/intelsdi-x/snap/control/plugin" - "github.com/intelsdi-x/snap/plugin/publisher/snap-publisher-mock-file/file" + "github.com/intelsdi-x/snap/plugin/publisher/snap-plugin-publisher-mock-file/file" ) func main() { diff --git a/plugin/publisher/snap-publisher-mock-file/main_small_test.go b/plugin/publisher/snap-plugin-publisher-mock-file/main_small_test.go similarity index 100% rename from plugin/publisher/snap-publisher-mock-file/main_small_test.go rename to plugin/publisher/snap-plugin-publisher-mock-file/main_small_test.go diff --git a/plugin/publisher/snap-publisher-mock-file/main_test.go b/plugin/publisher/snap-plugin-publisher-mock-file/main_test.go similarity index 96% rename from plugin/publisher/snap-publisher-mock-file/main_test.go rename to plugin/publisher/snap-plugin-publisher-mock-file/main_test.go index 9667ff873..e7e129423 100644 --- a/plugin/publisher/snap-publisher-mock-file/main_test.go +++ b/plugin/publisher/snap-plugin-publisher-mock-file/main_test.go @@ -33,7 +33,7 @@ import ( ) var ( - PluginName = "snap-publisher-mock-file" + PluginName = "snap-plugin-publisher-mock-file" PluginType = "publisher" SnapPath = os.Getenv("SNAP_PATH") PluginPath = path.Join(SnapPath, "plugin", PluginName) diff --git a/scheduler/distributed_task_test.go b/scheduler/distributed_task_test.go index ffb7ea2cb..96e2d4c67 100644 --- a/scheduler/distributed_task_test.go +++ b/scheduler/distributed_task_test.go @@ -64,9 +64,9 @@ func TestDistributedWorkflow(t *testing.T) { err := sch.Start() So(err, ShouldBeNil) // Load appropriate plugins into each control. - mock2Path := path.Join(PluginPath, "snap-collector-mock2") - passthruPath := path.Join(PluginPath, "snap-processor-passthru") - filePath := path.Join(PluginPath, "snap-publisher-mock-file") + mock2Path := path.Join(PluginPath, "snap-plugin-collector-mock2") + passthruPath := path.Join(PluginPath, "snap-plugin-processor-passthru") + filePath := path.Join(PluginPath, "snap-plugin-publisher-mock-file") // mock2 and file onto c1 @@ -203,9 +203,9 @@ func TestDistributedSubscriptions(t *testing.T) { err := sch.Start() So(err, ShouldBeNil) // Load appropriate plugins into each control. - mock2Path := path.Join(PluginPath, "snap-collector-mock2") - passthruPath := path.Join(PluginPath, "snap-processor-passthru") - filePath := path.Join(PluginPath, "snap-publisher-mock-file") + mock2Path := path.Join(PluginPath, "snap-plugin-collector-mock2") + passthruPath := path.Join(PluginPath, "snap-plugin-processor-passthru") + filePath := path.Join(PluginPath, "snap-plugin-publisher-mock-file") // mock2 and file onto c1 diff --git a/scheduler/workflow_test.go b/scheduler/workflow_test.go index 64580243b..9f609da70 100644 --- a/scheduler/workflow_test.go +++ b/scheduler/workflow_test.go @@ -48,10 +48,10 @@ import ( var ( SnapPath = os.Getenv("SNAP_PATH") - snap_collector_mock1_path = path.Join(SnapPath, "plugin", "snap-collector-mock1") - snap_collector_mock2_path = path.Join(SnapPath, "plugin", "snap-collector-mock2") - snap_processor_passthru_path = path.Join(SnapPath, "plugin", "snap-processor-passthru") - snap_publisher_file_path = path.Join(SnapPath, "plugin", "snap-publisher-mock-file") + snap_collector_mock1_path = path.Join(SnapPath, "plugin", "snap-plugin-collector-mock1") + snap_collector_mock2_path = path.Join(SnapPath, "plugin", "snap-plugin-collector-mock2") + snap_processor_passthru_path = path.Join(SnapPath, "plugin", "snap-plugin-processor-passthru") + snap_publisher_file_path = path.Join(SnapPath, "plugin", "snap-plugin-publisher-mock-file") metricsToCollect = 3 ) diff --git a/scripts/test.sh b/scripts/test.sh index f63004a13..34261df9a 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -43,10 +43,10 @@ _debug "project directory ${__proj_dir}" [[ "$SNAP_TEST_TYPE" =~ ^(small|medium|large|legacy)$ ]] || _error "invalid/missing SNAP_TEST_TYPE (value must be 'small', 'medium', 'large', or 'legacy', received:${SNAP_TEST_TYPE}" # If the following plugins don't exist, exit -[ -f $SNAP_PATH/plugin/snap-collector-mock1 ] || { _error 'Error: $SNAP_PATH/plugin/snap-collector-mock1 does not exist. Run make to build it.'; } -[ -f $SNAP_PATH/plugin/snap-collector-mock2 ] || { _error 'Error: $SNAP_PATH/plugin/snap-collector-mock2 does not exist. Run make to build it.'; } -[ -f $SNAP_PATH/plugin/snap-processor-passthru ] || { _error 'Error: $SNAP_PATH/plugin/snap-processor-passthru does not exist. Run make to build it.'; } -[ -f $SNAP_PATH/plugin/snap-publisher-mock-file ] || { _error 'Error: $SNAP_PATH/plugin/snap-publisher-mock-file does not exist. Run make to build it.'; } +[ -f $SNAP_PATH/plugin/snap-plugin-collector-mock1 ] || { _error 'Error: $SNAP_PATH/plugin/snap-plugin-collector-mock1 does not exist. Run make to build it.'; } +[ -f $SNAP_PATH/plugin/snap-plugin-collector-mock2 ] || { _error 'Error: $SNAP_PATH/plugin/snap-plugin-collector-mock2 does not exist. Run make to build it.'; } +[ -f $SNAP_PATH/plugin/snap-plugin-processor-passthru ] || { _error 'Error: $SNAP_PATH/plugin/snap-plugin-processor-passthru does not exist. Run make to build it.'; } +[ -f $SNAP_PATH/plugin/snap-plugin-publisher-mock-file ] || { _error 'Error: $SNAP_PATH/plugin/snap-plugin-publisher-mock-file does not exist. Run make to build it.'; } _go_path # If the following tools don't exist, get them