Testing

Quality, Quality, Quality

Infrastructure as Code (IAC) needs to be treated just like software core. It needs to go through the same lifecycle of:

  • Develop

  • Test

  • Release

Testing is a fundamentally important step to building solid infrastructure foundation and allowing others to leverage it. Testing infrastructure is a little different than testing code, and presently requires either some manual work or the use of a bigger workflow that includes Tuono.

Testing Strategies

If you have an existing environment that needs to be changed, the best way to develop and test those changes is to clone the environment and turn on development mode. Cloning an environment gives it a separate namespace to be provisioned into, which can coexist with the original environment. Once development mode is enabled in the environment, blueprints in that environment can be modified. While modifying a blueprint, a draft version is created.

After making the changes you want to make to a blueprint, you can apply the development environment. After applying the environment with the blueprint draft, you may want to visually inspect the venue management console, or run a test script of your own. When you are satisfied everything is as you want it, you can proceed to publishing the blueprint.

The modifying Blueprints tutorial demonstrates a best practices blueprint update leveraging a production and development environment.

Development View

The blueprints development view in the blueprints page allows you to rapidly develop, test and iterate when making changes to a blueprint that are part of an Environment in development mode.

Environment Development Mode

An Environment can only be selected from the blueprints development view when the environment is enabled for development mode. When an Environment has development mode enabled it allows you to add blueprints in the "draft" state. If an Environment is not in development mode that Environment can only select promoted blueprint versions.

Development view is enabled by selecting an Environment in Development mode from the blueprint editor and clicking "Open".

The development view displays a split panel view of the blueprint draft and the selected Environment.

Your Environment operations have the same functionality in the development view as they do on the Environments page. From here click on the ➕ to set the Environment blueprint to the draft under test.

Now you can rapidly make changes to the blueprint draft and perform operations on the Environment to test the changes from a single pane. The top tabs will list the Environment Blueprints, Variables and Jobs under current status. The Environment operations are outlined in the bottom tabs allowing you to apply, destroy, preview and compile. Clicking "Close" will close the development view pane and bring back the full screen blueprint editor.

Compiling

The compile operation can be a quick way to find syntax errors in your blueprint rather than continuing to try to simulate to see if there are any coding errors. Compile will process the Blueprint and display what will be provisioned. In the case if syntax errors in the blueprint, compile will provide errors indicating what to fix. You can run the compile operation in the blueprint development view or from the Environment page

When running compile on a blueprint without syntax errors you will see a window with the processed blueprint.

When running a compile operation on a blueprint that contains a syntax error you will get an error message that indicates what type of issue was found.

Let's say we define our subnet to include a firewall but the firewall name we use has a typo in it.

  subnet:
    public:
      range: 10.0.0.0/24
      network: testing
      firewall: only-ssh-aTYPOccess
      public: true

When running a compile operation the error returned will guide you to what part of the schema is wrong and what the issue could possibly be.

Last updated

Was this helpful?