Version:

Tester Guide

/ binnacle / latest / syntax/

Syntax

Test starts with an Binnacle keyword TEST, EXPECT, TRUE etc. The command should be written in quotes. For example,

TEST "stat ~/.ssh/id_rsa.pub"

If a test expects a different return code other than 0, then

TEST 1, "ls /non/existing/dir"

Comments

Use # for writing comments.

# This is comment
TEST "echo Hello"

Arguments

Arguments to Binnacle keywords are separated using ,(comma).

TEST 1, "ls /non/existing/dir"

Using Variables

Binnacle supports Ruby style variables, for example

kubectl = "microk8s.kubectl"

TEST "#{kubectl} get pods"

Capturing the output of a command

Easily capture the output of a command and use that value for validating the output. For example,

hostname = TEST "hostname"
TRUE hostname == "node1.example.com", "node1.example.com hostname test", "Actual: #{hostname}"

Block Syntax

Some keywords allows to limit the execution only within a block. Block starts with do and ends with end keyword. For example, the tests within the Block are executed in node1.example.com

# Executes in Local node
TEST "echo Hello"

USE_NODE "node1.example.com" do
  TEST "echo Hello"
end

# Again in local node
TEST "echo Hello"

Running tests in loop

Binnacle supports using list of values and run the tests in loop. Please note, It will lead to undefined behaviour if the list of items is dependent on previous tests.

nodes = ["node1.example.com", "node2.example.com", "node3.example.com"]

nodes.each do |node|
  # Set node
  USE_NODE node

  # Validate the hostname set properly
  EXPECT node, "hostname"
end

Loop syntax is same as in Ruby.

© 2021 Kadalu Software Private Limited. All Rights Reserved.