Kubeshop tests API

Tests operations

OpenAPI Specification

kubeshop-tests-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Testkube Standalone Agent api tests API
  description: API for Testkube Standalone Agent
  contact:
    email: info@testkube.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: 1.0.0
servers:
- url: https://api.testkube.io
  description: Testkube Cloud Control Plane API Endpoint
- url: https://<your-testkube-api-host>
  description: Testkube On-Prem API Endpoint
tags:
- name: tests
  description: Tests operations
paths:
  /test-suites/{id}/metrics:
    get:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/LastNDays'
      - $ref: '#/components/parameters/Limit'
      summary: Get test suite metrics
      description: Gets test suite metrics for given tests executions, with particular execution status and timings
      operationId: getTestSuiteMetrics
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionsMetrics'
        500:
          description: problem with read information from storage
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /executions:
    post:
      parameters:
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/Selector'
      - $ref: '#/components/parameters/ExecutionSelector'
      - $ref: '#/components/parameters/ConcurrencyLevel'
      tags:
      - tests
      summary: Starts new test executions
      description: New test executions returns new executions details on successful executions start
      operationId: executeTests
      requestBody:
        description: body passed to configure executions
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecutionRequest'
      responses:
        201:
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ExecutionResult'
        400:
          description: problem with request body
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: test not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with test executions
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests:
    get:
      tags:
      - tests
      summary: List tests
      description: List available tests
      operationId: listTests
      parameters:
      - $ref: '#/components/parameters/Selector'
      - $ref: '#/components/parameters/TextSearch'
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Test'
            text/yaml:
              schema:
                type: string
        400:
          description: invalid parameters
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    post:
      tags:
      - tests
      summary: Create new test
      description: Create new test based on file content, uri or git based data
      operationId: createTest
      requestBody:
        description: test details body
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestUpsertRequest'
          text/yaml:
            schema:
              type: string
      responses:
        200:
          description: successful operation
          content:
            text/yaml:
              schema:
                type: string
        201:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Test'
        400:
          description: problem with test definition - probably some bad input occurs (invalid JSON body or similar)
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    delete:
      tags:
      - tests
      summary: Delete tests
      description: Deletes all or labeled tests
      operationId: deleteTests
      parameters:
      - $ref: '#/components/parameters/Selector'
      responses:
        204:
          description: no content
        404:
          description: no tests found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with deleting tests and their executions
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests/{id}:
    patch:
      parameters:
      - $ref: '#/components/parameters/ID'
      tags:
      - tests
      summary: Update test
      description: Update test based on test content or git based data
      operationId: updateTest
      requestBody:
        description: test details body
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestUpdateRequest'
          text/yaml:
            schema:
              type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Test'
        400:
          description: problem with test definition - probably some bad input occurs (invalid JSON body or similar)
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: test not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    get:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Get test
      description: Gets the specified test
      operationId: getTest
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Test'
            text/yaml:
              schema:
                type: string
        400:
          description: invalid parameters
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: test not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    delete:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/SkipDeleteExecutions'
      - $ref: '#/components/parameters/SkipDeleteCRD'
      summary: Delete test
      description: Deletes a test
      operationId: deleteTest
      responses:
        204:
          description: no content
        404:
          description: no tests found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with deleting test and its executions
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests/{id}/abort:
    post:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Abort all executions of a test
      description: Abort all test executions
      operationId: abortTestExecutions
      responses:
        204:
          description: no content
        404:
          description: no execution found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with aborting test execution
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests/{id}/metrics:
    get:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/LastNDays'
      - $ref: '#/components/parameters/Limit'
      summary: Get test metrics
      description: Gets test metrics for given tests executions, with particular execution status and timings
      operationId: getTestMetrics
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionsMetrics'
        500:
          description: problem with getting metrics
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from storage
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /test-with-executions:
    get:
      tags:
      - tests
      summary: List test with executions
      description: List available test with executions
      operationId: listTestWithExecutions
      parameters:
      - $ref: '#/components/parameters/Selector'
      - $ref: '#/components/parameters/TextSearch'
      - $ref: '#/components/parameters/ExecutionsStatusFilter'
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageIndex'
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TestWithExecutionSummary'
            text/yaml:
              schema:
                type: string
        400:
          description: invalid parameters
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with getting tests and their executions
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /test-with-executions/{id}:
    get:
      tags:
      - tests
      parameters:
      - $ref: '#/components/parameters/ID'
      summary: Get test with execution
      description: Gets the specified test with execution
      operationId: getTestWithExecution
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestWithExecution'
            text/yaml:
              schema:
                type: string
        400:
          description: invalid parameters
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: no tests found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with getting tests and their executions
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests/{id}/executions:
    post:
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/TestExecutionName'
      tags:
      - tests
      summary: Starts new test execution
      description: New test execution returns new execution details on successful execution start
      operationId: executeTest
      requestBody:
        description: body passed to configure execution
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecutionRequest'
      responses:
        201:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionResult'
        400:
          description: problem with request body
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        404:
          description: test not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with communicating with kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with test execution
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    get:
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/LastNDays'
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageIndex'
      - $ref: '#/components/parameters/ExecutionsStatusFilter'
      - $ref: '#/components/parameters/StartDateFilter'
      - $ref: '#/components/parameters/EndDateFilter'
      tags:
      - tests
      summary: Get all test executions
      description: Returns array of all available test executions
      operationId: listTestExecutions
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionsResult'
        404:
          description: test or execution not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with getting test executions from storage
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /tests/{id}/executions/{executionID}:
    get:
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/executionID'
      tags:
      - tests
      summary: Get test execution
      description: Returns execution with given executionID
      operationId: getTestExecution
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Execution'
        404:
          description: execution not found
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: problem with getting test executions from storage
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        502:
          description: problem with reading secrets from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
    patch:
      parameters:
      - $ref: '#/components/parameters/ID'
      - $ref: '#/components/parameters/executionID'
      tags:
      - tests
      summary: Aborts execution
      description: Aborts execution with given executionID
      operationId: abortExecution
      responses:
        204:
          description: no content
        502:
          description: problem with read information from kubernetes cluster
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
  /uploads:
    post:
      tags:
      - tests
      summary: Upload file
      description: Upload file to be used in executions and tests
      operationId: uploads
      requestBody:
        $ref: '#/components/requestBodies/UploadsBody'
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                type: string
            text/yaml:
              schema:
                type: string
        400:
          description: problem with the input
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
        500:
          description: could not upload file
          content:
            application/problem+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Problem'
components:
  schemas:
    RunningContext:
      description: running context for test or test suite execution
      type: object
      required:
      - type
      properties:
        type:
          type: string
          description: One of possible context types
          enum:
          - userCLI
          - userUI
          - testsuite
          - testtrigger
          - scheduler
          - testworkflow
        context:
          type: string
          description: Context value depending from its type
    TestUpdateRequest:
      description: test update request body
      type: object
      nullable: true
      allOf:
      - $ref: '#/components/schemas/Test'
    TestStatus:
      type: object
      description: test status
      properties:
        latestExecution:
          $ref: '#/components/schemas/ExecutionCore'
    ArtifactRequest:
      description: artifact request body with test artifacts
      type: object
      properties:
        storageClassName:
          type: string
          description: artifact storage class name for container executor
          example: artifact-volume-local
        volumeMountPath:
          type: string
          description: artifact volume mount path for container executor
        dirs:
          type: array
          items:
            type: string
          description: artifact directories for scraping
        masks:
          type: array
          items:
            type: string
          description: regexp to filter scraped artifacts, single or comma separated
        storageBucket:
          type: string
          description: artifact bucket storage
          example: test1-artifacts
        omitFolderPerExecution:
          type: boolean
          description: don't use a separate folder for execution artifacts
        sharedBetweenPods:
          type: boolean
          description: whether to share volume between pods
        useDefaultStorageClassName:
          type: boolean
          description: whether to use default storage class name
        sidecarScraper:
          type: boolean
          description: run scraper as pod sidecar container
    TestUpsertRequest:
      description: test create request body
      type: object
      allOf:
      - $ref: '#/components/schemas/Test'
    Variables:
      type: object
      description: execution variables passed to executor converted to vars for usage in tests
      additionalProperties:
        $ref: '#/components/schemas/Variable'
      example:
        var1:
          name: var1
          type: basic
          value: value1
        secret1:
          name: secret1
          type: secret
          value: secretvalue1
    ExecutionCore:
      type: object
      description: test execution core
      properties:
        id:
          type: string
          description: execution id
          format: bson objectId
          example: 62f395e004109209b50edfc4
        number:
          type: integer
          description: execution number
          example: 1
        startTime:
          type: string
          description: test start time
          format: date-time
        endTime:
          type: string
          description: test end time
          format: date-time
        status:
          $ref: '#/components/schemas/ExecutionStatus'
    ExecutionsTotals:
      type: object
      description: various execution counters
      required:
      - results
      - passed
      - failed
      - queued
      - running
      - paused
      properties:
        results:
          type: integer
          description: the total number of executions available
        passed:
          type: integer
          description: the total number of passed executions available
        failed:
          type: integer
          description: the total number of failed executions available
        queued:
          type: integer
          description: the total number of queued executions available
        running:
          type: integer
          description: the total number of running executions available
    PodRequest:
      description: pod request body
      type: object
      properties:
        resources:
          $ref: '#/components/schemas/PodResourcesRequest'
          description: pod resources request parameters
        podTemplate:
          type: string
          description: pod template extensions
        podTemplateReference:
          type: string
          description: name of the template resource
    ExecutionsMetrics:
      type: object
      properties:
        passFailRatio:
          type: number
          description: Percentage pass to fail ratio
          example: 50
        executionDurationP50:
          type: string
          description: 50th percentile of all durations
          example: 7m2.71s
        executionDurationP50ms:
          type: integer
          description: 50th percentile of all durations in milliseconds
          example: 422
        executionDurationP90:
          type: string
          description: 90th percentile of all durations
          example: 7m2.71s
        executionDurationP90ms:
          type: integer
          description: 90th percentile of all durations in milliseconds
          example: 422
        executionDurationP95:
          type: string
          description: 95th percentile of all durations
          example: 7m2.71s
        executionDurationP95ms:
          type: integer
          description: 95th percentile of all durations in milliseconds
          example: 422
        executionDurationP99:
          type: string
          description: 99th percentile of all durations
          example: 7m2.71s
        executionDurationP99ms:
          type: integer
          description: 99th percentile of all durations in milliseconds
          example: 422
        totalExecutions:
          type: integer
          description: total executions number
          example: 2
        failedExecutions:
          type: integer
          description: failed executions number
          example: 1
        executions:
          type: array
          description: List of test/testsuite executions
          items:
            $ref: '#/components/schemas/ExecutionsMetricsExecutions'
    ConfigMapRef:
      required:
      - name
      - key
      type: object
      description: Testkube internal reference for data in Kubernetes config maps
      properties:
        namespace:
          type: string
          description: object kubernetes namespace
        name:
          type: string
          description: object name
        key:
          type: string
          description: object key
    Test:
      type: object
      properties:
        name:
          type: string
          description: test name
          example: test1
        namespace:
          type: string
          description: test namespace
          example: testkube
        description:
          type: string
          description: test description
          example: this test is used for that purpose
        type:
          type: string
          description: test type
          example: postman/collection
        content:
          $ref: '#/components/schemas/TestContent'
          description: test content
        source:
          type: string
          description: reference to test source resource
          example: my-private-repository-test
        created:
          type: string
          format: date-time
          example: '2022-07-30T06:54:15Z'
        labels:
          type: object
          description: test labels
          additionalProperties:
            type: string
          example:
            env: prod
            app: backend
        schedule:
          type: string
          description: schedule to run test
          example: '* * * * *'
        readOnly:
          type: boolean
          description: if test is offline and cannot be executed
        uploads:
          type: array
          items:
            type: string
          description: list of file paths that will be needed from uploads
          example:
          - settings/config.txt
        executionRequest:
          $ref: '#/components/schemas/ExecutionRequest'
        status:
          $ref: '#/components/schemas/TestStatus'
    ExecutionsMetricsExecutions:
      type: object
      properties:
        executionId:
          type: string
        groupId:
          type: string
        duration:
          type: string
        durationMs:
          type: integer
        status:
          type: string
        name:
          type: string
        startTime:
          type: string
          format: date-time
        runnerId:
          type: string
    ResourceRequest:
      description: resource request specification
      type: object
      properties:
        cpu:
          type: string
          description: requested cpu units
          example: 250m
        memory:
          type: string
          description: requested memory units
          example: 64Mi
    ExecutionStatus:
      type: string
      enum:
      - queued
      - running
      - passed
      - failed
      - aborted
      - timeout
      - skipped
      - canceled
    TestContentRequest:
      description: test content request body
      type: object
      properties:
        repository:
          $ref: '#/components/schemas/RepositoryParameters'
    Variable:
      type: object
      properties:
        name:
          type: string
        value:
          type: string
        type:
          $ref: '#/components/schemas/VariableType'
        secretRef:
          $ref: '#/components/schemas/SecretRef'
        configMapRef:
          $ref: '#/components/schemas/ConfigMapRef'
    PodResourcesRequest:
      description: pod resources request specification
      type: object
      properties:
        requests:
          $ref: '#/components/schemas/ResourceRequest'
          description: pod resources requests
        limits:
          $ref: '#/components/schemas/ResourceRequest'
          description: pod resources limits
    LocalObjectReference:
      description: Reference to Kubernetes object
      type: object
      properties:
        name:
          type: string
    RepositoryParameters:
      description: repository parameters for tests in git repositories
      type: object
      properties:
        branch:
          type: string
          description: branch/tag name for checkout
          example: main
        commit:
          type: string
          description: commit id (sha) for checkout
          example: b928cbb7186944ab9275937ec1ac3d3738ca2e1d
        path:


# --- truncated at 32 KB (58 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/kubeshop/refs/heads/main/openapi/kubeshop-tests-api-openapi.yml