Abstract

Documentation of the unit tests for this repository.

PostgreSQL Unit Tests#

Tests Usage#

To run these tests you need to install the unittest plugin.

  1. Install the plugin.

    helm plugin install https://github.com/helm-unittest/helm-unittest
    
  2. Run the tests.

    helm unittest -f 'tests/*.yaml' .
    

Service Test#

suite

PostgreSQL Service Test Suite


Tests for the Service template.

tests/service_test_suite.yaml#
suite: PostgreSQL Service Test Suite
release:
  name: postgres
set:
  service:
    enabled: true
templates:
  - "templates/service.yaml"
values:
  - ../values.yaml

tests:
  - it: "should render Service with correct metadata"
    asserts:
      - isKind:
          of: Service
      - matchSnapshot: {}

ServiceAccount Test#

suite

ServiceAccount Test Suite


Tests for the PostgreSQL ServiceAccount.

tests/serviceaccount_test_suite.yaml#
# :start-at: "suite: PostgreSQL ServiceAccount Test Suite"
# ```
suite: PostgreSQL ServiceAccount Test Suite
release:
  name: postgres
templates:
  - "templates/serviceaccount.yaml"
values:
  - ../values.yaml

tests:
  - it: "should render ServiceAccount with correct metadata"
    asserts:
      - isKind:
          of: ServiceAccount
      - matchSnapshot: {}

StatefulSet Test#

suite

StatefulSet Test


Tests the StatefulSet template values.

tests/statefulset_test.yaml#
# :start-at: "suite: PostgreSQL StatefulSet Test Suite"
# ```
suite: PostgreSQL StatefulSet Test Suite
release:
  name: postgres
templates:
  - "templates/statefulset.yaml"
set:
  type: StatefulSet
values:
  - ../values.yaml

tests:
  - it: "should render StatefulSet with correct metadata"
    asserts:
      - isKind:
          of: StatefulSet
  - it: should render statefulset correctly
    asserts:
      - matchSnapshot: {}