Mock Environments

A mock environment contains all services that you’re going to use for your project or release.

You should normally create a new environment when you start a new project. You can also clone an existing environment for a new release or to reuse the existing mocks.

The mock environments page lists all environments created within this installation of MockMotor:

Each environment has a human-readable name and unique URL prefix.

For example, an environment for the release 22 load test may be named “Release 22” and have the a prefix /R22. All services under this environment will begin their URLs with /R22, for example:

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


HTTP requests are routed to an environment where the prefix matches the beginning of the request URL, then to service where the prefix matches the next segment of the request URL.

For example, a request to http://hostname/R22/Accounts will be routed to environment (/R22) and then to Accounts Service (/Accounts).

Creating a New Mock Environment

To create a new empty environment, you should click on Add Environment button:

In the New Environment dialog, provide the environment information:

The environment name can be any human-readable name. The environment URL prefix should be unique within the MockMotor installation.

You can also provide a free text description for more information on the environment’s purpose.

You can enable the environment log to help with initial configuration and troubleshooting. Note, however, that the execution log may affect the performance. So consider disabling it during heavy load tests.

Finally, click on “Save” button to create the environment.

You also automatically become the owner of the environment that you’ve created( i.e. you can do any change within it including deleting it). Other users do not have this right unless you grant them ownership.

Environment Properties

Name

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

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

Unique Prefix URL

Each environment has a 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 the /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

The full environment URL is built by the 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, you can any notes that you need to have about why this environment was created, who uses it and generally any information that you or your coworkers may find useful to know about this environment.

Status

An environment may be enabled or archived.

An enabled environment handles all traffic that comes under its prefix URL. This is the default state of an environment.

An archived environment rejects all traffic. This is useful to suppress traffic from URLs that are 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 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 resources.

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

HTTP/1.1 500 Server Error
...

The environment [MockMotor 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)[/doc/troubleshooting-execution-log/] provides you with this information.

Note, however, that it has some, although minor, performance impact. If you’re running a high-TPS (20+) test, consider disabling 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”:

  • The environment name can be any human-readable name.
  • The environment URL prefix should be unique within the MockMotor installation.
  • You can also provide a text description for more information about the environment’s purpose.
  • Unless you’re done with the environment, you will 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 disabling it during heavy load tests.
  • Finally, click the “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 a “(Clone)” marker and the environment URL will have 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 archiving the environments first and only deleting them when it is clear that you do not need anything from them anymore.

    To permanently delete an environment, click on the “Delete” button on Environment page and confirm your choice in the dialog box.

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