AmitKumarDas / elitmus

litmus test your kubernetes infrastructure without learning curves
Apache License 2.0
2 stars 2 forks source link

UserStory to LitmusClass, LitmusClaim & LitmusResult #5

Open AmitKumarDas opened 6 years ago

AmitKumarDas commented 6 years ago

User Story

Feature: Test deployment of Minio on Kubernetes PV
  In order to test deployment of Minio on Kubernetes PV
  As an end user
  I need to be able to launch Minio on Kubernetes PV

  Scenario: launch Minio on PV
    Given I have a kubernetes cluster with volume operator installed
    When I launch minio application on volume
    Then wait for "180s"
    And verify minio application is launched successfully on volume
    And verify PVC is bound
    And verify PV is deployed

LitmusClass - A user story is converted to a LitmusClass.

This is a CustomResource understood by Litmus operator/controller.

kind: LitmusClass
metadata:
  name: minio_litmus_test
spec:
  feature: |
    desc: |
      Test deployment of Minio on Kubernetes PV
      In order to test deployment of Minio on Kubernetes PV
      As an end user
      I need to be able to launch Minio on Kubernetes PV
  scenario: |
    desc: |
      launch Minio on PV
      - desc: Given I have a kubernetes cluster with volume operator installed
        steps:
          - {{- kctlGetDeploy .Values.openebs.mayaApiServer.name | jsonpath `{.status}` | isRunning -}}
          - {{- kctlGetDeploy .Values.openebs.dynamicProvisioner.name | jsonpath `{.status}` | isRunning -}}
      - desc: When I launch minio application on volume
        steps:
          - {{- kctlApply .Values.app.minio.yaml | isOK -}}
      - desc: Then wait for "180s"
        steps:
          - {{- wait "180s" -}}
      - desc: And verify minio application is launched successfully on volume
        steps:
          - {{- kctlListPod .Values.openebs.replica.selector | jsonpath `{.spec.mountPath}` | isOK -}}
      - desc: And verify PVC is bound
        steps:
          - {{- blah blah function -}}
      - desc: And verify PV is deployed
        steps:
          - {{- blah blah function -}}
  onFail:
    - {{- isIscsiLoaded -}}
    - {{- isReadWriteOnce -}}
    - {{- isDiskPressure -}}
    - {{- isMemoryPress -}}

LitmusClaim

kind: LitmusClaim
metadata:
  name: run_my_test
spec:
  class: name of litmus class
  values: blah blah

LitmusResult - A CustomResource generated by LitmusOperator when a new LitmusClaim is made

kind: LitmusResult
metadata:
  name: got_your_run_test
spec:
  feature: |
    desc: |
      Test deployment of Minio on Kubernetes PV
      In order to test deployment of Minio on Kubernetes PV
      As an end user
      I need to be able to launch Minio on Kubernetes PV
    scenarios:
      - desc: launch Minio on PV
        - desc: Given I have a kubernetes cluster with volume operator installed
          status: OK
        - desc: When I launch minio application on volume
          status: OK
        - desc: Then wait for "180s"
          status: OK
        - desc: And verify minio application is launched successfully on volume
          status: OK
        - desc: And verify PVC is bound
          status: OK
        - desc: And verify PV is deployed
          status: OK
    status:
      starttime:
      endtime:
      reason:
AmitKumarDas commented 6 years ago

LitmusClaim should embed the Values required to execute the LitmusClass template. The Values may even contain the full Kubernetes resource yaml.

AmitKumarDas commented 6 years ago

Can this handle simple resource verification as done via this project. https://github.com/lrills/helm-unittest/blob/master/README.md

AmitKumarDas commented 6 years ago

Check if CAS template can be used and at the same time the user friendliness can be retained.

The template functions should be added dynamically. CAS template will be used as a library.