Bot playground (sandbox) server


#1

This is a proposal, for Rocket.Chat to host an instance for testing bots and the JS SDK (e.g. playground.rocket.chat). Putting it up to canvas needs and advice on execution from the community to make sure it provides value for all and the utility is surfaced.

It would provide for both automated unit testing and manual acceptance tests. The instance would be open to anyone to create users, rooms and run whatever bots they want but would be refreshed every 24 hours, removing all users, clearing all history and rooms other than general. There’s something sort of similar going on in the #hubot channel now, but it just looks like spam within the main instance. Setting all the spam and random test interactions aside in it’s own instance might improve the average quality of discussion on open.rocket.chat

Related issue: https://github.com/RocketChat/Rocket.Chat.js.SDK/issues/8

I have floated this with a few core team members (e.g. @sing.li, @rodrigo.nascimento) and @aaron.ogle has agreed in principle to help set it up in the official cloud environment, perhaps with some dev-ops scripting help from @JSzaszvari to setup the operations to do the refreshing (Aaron suggested using cron script calling the API to clean everything up).

Running the SDK unit tests currently requires a local instance of Rocket.Chat, manually provisioned by the developer, so this would remove that dependency, making bot and SDK development easier and cut about 20 minutes off the local dev env setup.

It would also be very handy for testing the new bot admin and deployment features @mikaelmello is working on, to create a user, spin up a new bot and start interacting with it, all within a pre-provisioned Rocket.Chat instance. Magic!

I’d like to have some prospective version of this going in a couple weeks so it’s useful during GSOC, but can iterate over a longer period as community feedback comes in.

Thoughts?


#2

I guess the big question now is. How hard would it be to write a script to prune all users, rooms and messages?

If we restricted private groups… I think we could loop over public channels and delete them fairly easy. Also could loop over users I think


#3

I don’t think too difficult maybe a hour or two of work to figure it out.


#4

In the SDK I have a setup method that prepares a local instance for the tests that will run, creating user and rooms etc. The provisioning script would basically be this, but with rooms and history cleared first. I can contribute that as a node script if @aaron.ogle can setup the instance / env config and @JSzaszvari can manage the cron and help me troubleshoot the script with whatever other magic it needs to execute.

The requirements / config, I would think is something like:

  • Have a few default users that are full admins (us shared maintainers).
  • Permissions allow all users to create other users / bots / rooms.
  • Bot role could be a bit more permissive for testing scripts, e.g. can view full user info
  • Could disable email verification required and if possible all email sending (won’t need password recovery etc)

Sound OK???


#5

https://botplayground.rocket.chat/ Feel free to create accounts and I can bump to admin.

If we get a solid cronjob we can also schedule that to run.

As far as accounts persisted I think can create role for the accounts to be persisted maybe? Though that may complicate the clean up a bit to check role? Alternatively delete everyone but admins.