Mock Environment

A mock environment is a container for all services you’re going to use for your project or release.

Environment Properties

Name

Each environment should have an unique human-readable name, so you can easily refer to it when talking to your coworkers.

For example, your environment can be called “R74” for release 74 services, or “V7 Launch” for tests targeted at a special high-volume event.

Unique Prefix URL

Each environment has an unique prefix URL. All services’ URLs in that environment start with that prefix.

For example, if two services, Accounts and Payments, are placed into an environment with /R22 prefix, their full URLs will start with the environment prefix:

Property Value
Environment Name Release 22
Environment URL Prefix /R22
Accounts Service URL /R22/Account
Payments Service URL /R22/Payments
… and so on …

Full URL

Full environment URL is built by combining MockMotor installation URL and the environment URL prefix. This full URL is not actually used anywhere (unlike full services’ URLs), and is provided only for reference.

Description

Here place any notes you need to have about why this environment was created, who uses it and generally any information you or your coworkers may find useful about this environment.

Status

An environment may be enabled or archived.

Enabled environment is handling all traffic that comes under its prefix URL. This is the default state of an environment.

Archived environment is rejecting all traffic. This is useful to suppress traffic from URLs accidentally left in calling applications and still pointing to this environment. Such leftover URLs can cause a lot of troubleshooting pain, when the applications behave strangely and it is hard to figure out why.

The best practice then is to archive an environment as soon as it is not used.

Archived environments are moved to the bottom of the environments list. Also, not all data from archived environments are loaded, which saves the resources.

Archived environments reject all requests sent to them with HTTP 500 and a message that the environment is archived:

HTTP/1.1 500 Server Error
...

The environment [MockEngine SelfTest (Disabled)] is archived and doesn't handle any traffic
...

Execution Log

For troubleshooting purposes you may want to see all the requests that are coming into the environment, and what responses are handling those requests. When enabled, the execution log provides you with exactly this information.

Note however that it has some, although minor, performance impact. If you’re running a high-TPS (20+) test, consider to disable the execution log for the duration of the test.

You can see the execution log under the Log tab on the environment page.

Modifying Environment Information

You need to be the environment owner or an admin to make any changes in it.

To change the environment properties, update the environment information and click Save:

  • Environment name can be any human-readable name.
  • Environment URL prefix should be unique within MockMotor installation.
  • You can also provide a text description for more information on the environment purpose.
  • Unless you’re done with the environment, you’d want to keep it enabled.
  • You can enable the execution log to help with initial configuration and troubleshooting. Note however that it may affect the performance, so consider to disable it during heavy load tests.
  • Finally, click on Save button.

    Clone an Environment

    If you run a very similar set of tests periodically, you can save a lot of time by cloning the previously used environment into a new one.

    You can clone an environment that you do not own. The source environment will not be changed, only copied into the new one. All services, responses and accounts will be copied, but you’ll be the only owner of the new environment.

    To perform cloning, click on the Clone button on the environment page:

    After some processing, you’ll be navigated to the cloned environment page.

    Note that the environment name is modified to add “(Clone)” marker, and the environment URL got a random suffix to prevent a conflict with the original environment. Change these values to something appropriate for your new environment.

    Delete Environment

    You need to be an owner of the environment or an admin to delete an environment.

    Because deleting an environment is irreversible I suggest to archive the environments first, and only delete them when it is clear you do not need anything from them anymore.

    To permanently delete an environment, click on Delete button on environment page and confirm you choice in the dialog.

    After deletion you’ll be taken to the environments list.