artilleryio / artillery-core

artillery-core - deprecated
Mozilla Public License 2.0
29 stars 105 forks source link

'artillery-plugin-' prefix not flexible for private plugin naming conventions #108

Open tresor616 opened 7 years ago

tresor616 commented 7 years ago

What's the reason for having the 'artillery-plugin-' prefix?

Many organizations keep their own repositories for obvious reasons and with that comes varying naming conventions. More flexibility should be allowed here.

hassy commented 7 years ago

The reason is zero-config discovery of plugins, i.e. as a user you just need to add the name of the plugin + its settings to your test script, and Artillery will know how to load it.

Can you give a bit more detail on why that doesn't work for private plugins?

tresor616 commented 7 years ago

We package our custom packages in scopes/namespaces, e.g. @organization_name/package_name because there could be a clashing name in some of our registered repositories.

Enforcing the prefix "artillery-plugin-" suggests there would be a universal distinct list of package names which is not always the case, take an example with artillery on github, its https://github.com/shoreditch-ops/artillery instead of https://github.com/artillery because many people/namespaces can have the same name.

I need to be sure at all times that when I run npm install, my custom package will be loaded. I suggest the code below just read the plugin name as provided

...
    let requireString = 'artillery-plugin-' + pluginName;
    let Plugin, plugin;
    try {
      Plugin = require(requireString);
...

I am happy to submit a pull request for this change.

hassy commented 7 years ago

Cool. Will gladly accept a PR which allows something like:

config:
  plugins:
    some-custom-plugin:
      package: "@prefix/some-package-name"
      option1: "something"
      option2: "somethingElse"
scenarios:
  # ...

To load the plugin from @prefix/some-package-name rather than artillery-plugin-some-custom-plugin.

tresor616 commented 7 years ago

I don't seem to have write access to this repo, I was trying to push a branch

hassy commented 7 years ago

You need to fork and send a pull request.

On Friday, 28 October 2016, Treasure Mathala notifications@github.com wrote:

I don't seem to have write access to this repo, I was trying to push a branch

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shoreditch-ops/artillery-core/issues/108#issuecomment-256869016, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAF0qV1aauUAnSzaIT2wsnzKcFDrbu1ks5q4bcAgaJpZM4KiXys .

tresor616 commented 7 years ago

pull request: https://github.com/shoreditch-ops/artillery-core/pull/109

hassy commented 7 years ago

Two things to do before we can close this:

  1. make the trailing slash in the scope attribute optional
  2. document the change