{
  "description": "Test is the Schema for the tests API",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "TestSpec defines the desired state of Test",
      "properties": {
        "content": {
          "description": "test content object",
          "properties": {
            "data": {
              "description": "test content body",
              "type": "string"
            },
            "repository": {
              "description": "repository of test content",
              "properties": {
                "authType": {
                  "description": "auth type for git requests",
                  "enum": [
                    "basic",
                    "header",
                    "github"
                  ],
                  "type": "string"
                },
                "branch": {
                  "description": "branch/tag name for checkout",
                  "type": "string"
                },
                "certificateSecret": {
                  "description": "git auth certificate secret for private repositories",
                  "type": "string"
                },
                "commit": {
                  "description": "commit id (sha) for checkout",
                  "type": "string"
                },
                "path": {
                  "description": "if needed we can checkout particular path (dir or file) in case of BIG/mono repositories",
                  "type": "string"
                },
                "tokenSecret": {
                  "description": "SecretRef is the Testkube internal reference for secret storage in Kubernetes secrets",
                  "properties": {
                    "key": {
                      "description": "object key",
                      "type": "string"
                    },
                    "name": {
                      "description": "object name",
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "name"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": {
                  "description": "VCS repository type",
                  "type": "string"
                },
                "uri": {
                  "description": "uri of content file or git directory",
                  "type": "string"
                },
                "usernameSecret": {
                  "description": "SecretRef is the Testkube internal reference for secret storage in Kubernetes secrets",
                  "properties": {
                    "key": {
                      "description": "object key",
                      "type": "string"
                    },
                    "name": {
                      "description": "object name",
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "name"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "workingDir": {
                  "description": "if provided we checkout the whole repository and run test from this directory",
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "type": {
              "description": "test type",
              "enum": [
                "string",
                "file-uri",
                "git-file",
                "git-dir",
                "git"
              ],
              "type": "string"
            },
            "uri": {
              "description": "uri of test content",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "description": {
          "description": "test description",
          "type": "string"
        },
        "executionRequest": {
          "description": "test execution request body",
          "properties": {
            "activeDeadlineSeconds": {
              "description": "Optional duration in seconds the pod may be active on the node relative to\nStartTime before the system will actively try to mark it failed and kill associated containers.\nValue must be a positive integer.",
              "format": "int64",
              "type": "integer"
            },
            "args": {
              "description": "additional executor binary arguments",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "argsMode": {
              "description": "usage mode for arguments",
              "enum": [
                "append",
                "override",
                "replace"
              ],
              "type": "string"
            },
            "artifactRequest": {
              "description": "artifact request body with test artifacts",
              "properties": {
                "dirs": {
                  "description": "artifact directories for scraping",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "masks": {
                  "description": "regexp to filter scraped artifacts, single or comma separated",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "omitFolderPerExecution": {
                  "description": "don't use a separate folder for execution artifacts",
                  "type": "boolean"
                },
                "sharedBetweenPods": {
                  "description": "whether to share volume between pods",
                  "type": "boolean"
                },
                "sidecarScraper": {
                  "description": "run scraper as pod sidecar container",
                  "type": "boolean"
                },
                "storageBucket": {
                  "description": "artifact bucket storage",
                  "type": "string"
                },
                "storageClassName": {
                  "description": "artifact storage class name for container executor",
                  "type": "string"
                },
                "useDefaultStorageClassName": {
                  "description": "whether to use default storage class name",
                  "type": "boolean"
                },
                "volumeMountPath": {
                  "description": "artifact volume mount path for container executor",
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "command": {
              "description": "executor binary command",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "cronJobTemplate": {
              "description": "cron job template extensions",
              "type": "string"
            },
            "cronJobTemplateReference": {
              "description": "name of the template resource",
              "type": "string"
            },
            "disableWebhooks": {
              "description": "whether webhooks should be called on execution\nDeprecated: field is not used",
              "type": "boolean"
            },
            "envConfigMaps": {
              "description": "config map references",
              "items": {
                "description": "Reference to env resource",
                "properties": {
                  "mapToVariables": {
                    "description": "whether we shoud map to variables from resource",
                    "type": "boolean"
                  },
                  "mount": {
                    "description": "whether we shoud mount resource",
                    "type": "boolean"
                  },
                  "mountPath": {
                    "description": "where we shoud mount resource",
                    "type": "string"
                  },
                  "reference": {
                    "description": "LocalObjectReference contains enough information to let you locate the\nreferenced object inside the same namespace.",
                    "properties": {
                      "name": {
                        "default": "",
                        "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                        "type": "string"
                      }
                    },
                    "type": "object",
                    "x-kubernetes-map-type": "atomic",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "reference"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "envSecrets": {
              "description": "secret references",
              "items": {
                "description": "Reference to env resource",
                "properties": {
                  "mapToVariables": {
                    "description": "whether we shoud map to variables from resource",
                    "type": "boolean"
                  },
                  "mount": {
                    "description": "whether we shoud mount resource",
                    "type": "boolean"
                  },
                  "mountPath": {
                    "description": "where we shoud mount resource",
                    "type": "string"
                  },
                  "reference": {
                    "description": "LocalObjectReference contains enough information to let you locate the\nreferenced object inside the same namespace.",
                    "properties": {
                      "name": {
                        "default": "",
                        "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                        "type": "string"
                      }
                    },
                    "type": "object",
                    "x-kubernetes-map-type": "atomic",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "reference"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "envs": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Environment variables passed to executor.\nDeprecated: use Basic Variables instead",
              "type": "object"
            },
            "executePostRunScriptBeforeScraping": {
              "description": "execute post run script before scraping (prebuilt executor only)",
              "type": "boolean"
            },
            "executionLabels": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "test execution labels",
              "type": "object"
            },
            "executionNamespace": {
              "description": "namespace for test execution (Pro edition only)",
              "type": "string"
            },
            "httpProxy": {
              "description": "http proxy for executor containers",
              "type": "string"
            },
            "httpsProxy": {
              "description": "https proxy for executor containers",
              "type": "string"
            },
            "image": {
              "description": "container executor image",
              "type": "string"
            },
            "imagePullSecrets": {
              "description": "container executor image pull secrets",
              "items": {
                "description": "LocalObjectReference contains enough information to let you locate the\nreferenced object inside the same namespace.",
                "properties": {
                  "name": {
                    "default": "",
                    "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                    "type": "string"
                  }
                },
                "type": "object",
                "x-kubernetes-map-type": "atomic",
                "additionalProperties": false
              },
              "type": "array"
            },
            "isVariablesFileUploaded": {
              "type": "boolean"
            },
            "jobTemplate": {
              "description": "job template extensions",
              "type": "string"
            },
            "jobTemplateReference": {
              "description": "name of the template resource",
              "type": "string"
            },
            "name": {
              "description": "test execution custom name",
              "type": "string"
            },
            "namespace": {
              "description": "test kubernetes namespace (\\\"testkube\\\" when not set)",
              "type": "string"
            },
            "negativeTest": {
              "description": "negative test will fail the execution if it is a success and it will succeed if it is a failure",
              "type": "boolean"
            },
            "number": {
              "description": "test execution number",
              "format": "int32",
              "type": "integer"
            },
            "postRunScript": {
              "description": "script to run after test execution",
              "type": "string"
            },
            "preRunScript": {
              "description": "script to run before test execution",
              "type": "string"
            },
            "pvcTemplate": {
              "description": "pvc template extensions",
              "type": "string"
            },
            "pvcTemplateReference": {
              "description": "name of the template resource",
              "type": "string"
            },
            "scraperTemplate": {
              "description": "scraper template extensions",
              "type": "string"
            },
            "scraperTemplateReference": {
              "description": "name of the template resource",
              "type": "string"
            },
            "secretEnvs": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Execution variables passed to executor from secrets.\nDeprecated: use Secret Variables instead",
              "type": "object"
            },
            "slavePodRequest": {
              "description": "pod request body",
              "properties": {
                "podTemplate": {
                  "description": "pod template extensions",
                  "type": "string"
                },
                "podTemplateReference": {
                  "description": "name of the template resource",
                  "type": "string"
                },
                "resources": {
                  "description": "pod resources request specification",
                  "properties": {
                    "limits": {
                      "description": "resource request specification",
                      "properties": {
                        "cpu": {
                          "description": "requested cpu units",
                          "type": "string"
                        },
                        "memory": {
                          "description": "requested memory units",
                          "type": "string"
                        }
                      },
                      "type": "object",
                      "additionalProperties": false
                    },
                    "requests": {
                      "description": "resource request specification",
                      "properties": {
                        "cpu": {
                          "description": "requested cpu units",
                          "type": "string"
                        },
                        "memory": {
                          "description": "requested memory units",
                          "type": "string"
                        }
                      },
                      "type": "object",
                      "additionalProperties": false
                    }
                  },
                  "type": "object",
                  "additionalProperties": false
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "sourceScripts": {
              "description": "run scripts using source command (container executor only)",
              "type": "boolean"
            },
            "sync": {
              "description": "whether to start execution sync or async",
              "type": "boolean"
            },
            "testSecretUUID": {
              "description": "test secret uuid",
              "type": "string"
            },
            "testSuiteName": {
              "description": "unique test suite name (CRD Test suite name), if it's run as a part of test suite",
              "type": "string"
            },
            "testSuiteSecretUUID": {
              "description": "test suite secret uuid, if it's run as a part of test suite",
              "type": "string"
            },
            "variables": {
              "additionalProperties": {
                "properties": {
                  "name": {
                    "description": "variable name",
                    "type": "string"
                  },
                  "type": {
                    "description": "variable type",
                    "type": "string"
                  },
                  "value": {
                    "description": "variable string value",
                    "type": "string"
                  },
                  "valueFrom": {
                    "description": "or load it from var source",
                    "properties": {
                      "configMapKeyRef": {
                        "description": "Selects a key of a ConfigMap.",
                        "properties": {
                          "key": {
                            "description": "The key to select.",
                            "type": "string"
                          },
                          "name": {
                            "default": "",
                            "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                            "type": "string"
                          },
                          "optional": {
                            "description": "Specify whether the ConfigMap or its key must be defined",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic",
                        "additionalProperties": false
                      },
                      "fieldRef": {
                        "description": "Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`,\nspec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.",
                        "properties": {
                          "apiVersion": {
                            "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\".",
                            "type": "string"
                          },
                          "fieldPath": {
                            "description": "Path of the field to select in the specified API version.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "fieldPath"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic",
                        "additionalProperties": false
                      },
                      "resourceFieldRef": {
                        "description": "Selects a resource of the container: only resources limits and requests\n(limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.",
                        "properties": {
                          "containerName": {
                            "description": "Container name: required for volumes, optional for env vars",
                            "type": "string"
                          },
                          "divisor": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "string"
                              }
                            ],
                            "description": "Specifies the output format of the exposed resources, defaults to \"1\"",
                            "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                            "x-kubernetes-int-or-string": true
                          },
                          "resource": {
                            "description": "Required: resource to select",
                            "type": "string"
                          }
                        },
                        "required": [
                          "resource"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic",
                        "additionalProperties": false
                      },
                      "secretKeyRef": {
                        "description": "Selects a key of a secret in the pod's namespace",
                        "properties": {
                          "key": {
                            "description": "The key of the secret to select from.  Must be a valid secret key.",
                            "type": "string"
                          },
                          "name": {
                            "default": "",
                            "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                            "type": "string"
                          },
                          "optional": {
                            "description": "Specify whether the Secret or its key must be defined",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic",
                        "additionalProperties": false
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "type": "object",
                "additionalProperties": false
              },
              "type": "object"
            },
            "variablesFile": {
              "description": "variables file content - need to be in format for particular executor (e.g. postman envs file)",
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "name": {
          "description": "test name",
          "type": "string"
        },
        "schedule": {
          "description": "schedule in cron job format for scheduled test execution",
          "type": "string"
        },
        "source": {
          "description": "reference to test source resource",
          "type": "string"
        },
        "type": {
          "description": "test type",
          "type": "string"
        },
        "uploads": {
          "description": "files to be used from minio uploads",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "TestStatus defines the observed state of Test",
      "properties": {
        "latestExecution": {
          "description": "latest execution result",
          "properties": {
            "endTime": {
              "description": "test end time",
              "format": "date-time",
              "type": "string"
            },
            "id": {
              "description": "execution id",
              "type": "string"
            },
            "number": {
              "description": "execution number",
              "format": "int32",
              "type": "integer"
            },
            "startTime": {
              "description": "test start time",
              "format": "date-time",
              "type": "string"
            },
            "status": {
              "enum": [
                "queued",
                "running",
                "passed",
                "failed",
                "aborted",
                "timeout"
              ],
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
