Usage

Table of Contents

Introduction

The Nikita API is simple and concise. It also powerful and comes with a lot of functionalities. This section detail the subtleties of the API organized by topics. A lot of effort were made to illustrate each topic with clear examples.

Recommendation

Before going through the documentation, you must be familiar with the core concept of Nikita described in the tutorial.

Content

The topics of this section are organized by relevance, the first ones being considered as the most relevant ones.

  • Actions, options, handlers and callbacks
    An action is the single unit of work in Nikita. It is made of a simple JavaScript object which we call options.
  • Call and user defined handlers
    Nikita gives you the choice between calling your own function, which we call handlers, or calling an registered function by its name.
  • Sync and async execution
    The asynchronous nature of JavaScript coupled with how Nikita register new actions can be a little tricky for newcomers. Handlers can be written in both synchronous and asynchronous based on the presence of a callback argument in the handler signature. Moreover, it is possible to write a synchronous handler which schedules asynchronous actions.
  • Status
    The status is an information indicating whether an action had any impact or not. It's meaning may differ from one action to another, for example: touching a file, modification of a configuration file, checking if a port is open, ...
  • Local and remote (SSH) execution
    Actions are designed to run transparently either locally or remotely through SSH. The tests are themselves written to run in both modes.
  • Conditions and assertions
    Conditions and assertions are a set of options available to every handlers to control and guaranty their execution.
  • Debugging and Logging
    Nikita provides multiple mechanisms to report, dive into the logs and intercept instructions. Most of them can be instantaneously activated and you are provided with simple building blocks to quickly write your own.
  • Events API
    A Nikita session extends the native Node.js Events API. It provides a facility to listen to internal notification and know the current state of the program.
  • Control Flow
    Nikita run every actions sequentially. This behavior ensures there are no conflict between two commands executed simultaneously. Moreover, this sequential nature is aligned with SSH which execute one command at a time over a given connection.
  • Error handling
    Nikita implements error management by following familiar Node.js conventions. The handling of errors different slightly between synchronous and asynchronous functions.