Skip to content

Commit

Permalink
feat: script source
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Jan 28, 2022
1 parent 62a1ed2 commit f212f13
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 75 deletions.
85 changes: 28 additions & 57 deletions api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,14 @@ components:
name:
type: string
description: script name
namespace:
type: string
description: script namespace
type:
type: string
description: script type
enum:
- postman/collection
content:
type: string
$ref: "#/components/schemas/ScriptContent"
description: script content
created:
type: string
Expand All @@ -1104,6 +1105,26 @@ components:
type: string
description: script tags

ScriptContent:
type: object
properties:
type:
type: string
description: script type
enum:
- file-string
- file-uri
- git-file
- git-dir
repository:
$ref: "#/components/schemas/Repository"
content:
type: string
description: script content
uri:
type: string
description: script content

Execution:
type: object
description: API server script execution
Expand Down Expand Up @@ -1143,11 +1164,8 @@ components:
example:
users: "3"
prefix: "some-"
scriptContent:
type: string
description: script metadata content
repository:
$ref: "#/components/schemas/Repository"
content:
$ref: "#/components/schemas/ScriptContent"
startTime:
type: string
description: "test start time"
Expand Down Expand Up @@ -1459,55 +1477,8 @@ components:

ScriptUpsertRequest:
description: scripts create request body
type: object
properties:
name:
type: string
description: script name - Custom Resource name - must be unique, use only lowercase numbers and dashes (-)
example: kubeshop-homepage-test
type:
type: string
description: script type - what executor type should be used during test execution
example: postman/collection
namespace:
type: string
description: kubernetes namespace (defaults to 'testkube')
example: testkube
inputType:
type: string
description: >
script content type can be:
- direct content - created from file,
- git repo directory checkout in case when test is some kind of project or have more than one file,
enum:
- content
- git
tags:
type: array
items:
type: string
repository:
$ref: "#/components/schemas/Repository"
content:
type: string
description: script content - executor specific e.g. fo postman-collections executor
example: >
{
"info": {
"_postman_id": "57ad6291-5b8f-4b2d-b24d-d2d2ce8785bb",
"name": "SimpleKubeshop",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Homepage",
"request": {
"method": "GET",
"header": [],
"url": null
},
"response": []
}
allOf:
- $ref: "#/components/schemas/Script"

TestUpsertRequest:
description: test create request body
Expand Down
6 changes: 2 additions & 4 deletions pkg/api/v1/testkube/model_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ type Execution struct {
// additional arguments/flags passed to executor binary
Args []string `json:"args,omitempty"`
// execution params passed to executor converted to vars for usage in tests
Params map[string]string `json:"params,omitempty"`
// script metadata content
ScriptContent string `json:"scriptContent,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Params map[string]string `json:"params,omitempty"`
Content *ScriptContent `json:"content,omitempty"`
// test start time
StartTime time.Time `json:"startTime,omitempty"`
// test end time
Expand Down
9 changes: 5 additions & 4 deletions pkg/api/v1/testkube/model_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import (
type Script struct {
// script name
Name string `json:"name,omitempty"`
// script namespace
Namespace string `json:"namespace,omitempty"`
// script type
Type_ string `json:"type,omitempty"`
// script content
Content string `json:"content,omitempty"`
Created time.Time `json:"created,omitempty"`
Type_ string `json:"type,omitempty"`
Content *ScriptContent `json:"content,omitempty"`
Created time.Time `json:"created,omitempty"`
// script tags
Tags []string `json:"tags,omitempty"`
}
20 changes: 20 additions & 0 deletions pkg/api/v1/testkube/model_script_content.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* TestKube API
*
* TestKube provides a Kubernetes-native framework for test definition, execution and results
*
* API version: 1.0.0
* Contact: [email protected]
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package testkube

type ScriptContent struct {
// script type
Type_ string `json:"type,omitempty"`
Repository *Repository `json:"repository,omitempty"`
// script content
Content string `json:"content,omitempty"`
// script content
Uri string `json:"uri,omitempty"`
}
22 changes: 12 additions & 10 deletions pkg/api/v1/testkube/model_script_upsert_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
*/
package testkube

import (
"time"
)

// scripts create request body
type ScriptUpsertRequest struct {
// script name - Custom Resource name - must be unique, use only lowercase numbers and dashes (-)
// script name
Name string `json:"name,omitempty"`
// script type - what executor type should be used during test execution
Type_ string `json:"type,omitempty"`
// kubernetes namespace (defaults to 'testkube')
// script namespace
Namespace string `json:"namespace,omitempty"`
// script content type can be: - direct content - created from file, - git repo directory checkout in case when test is some kind of project or have more than one file,
InputType string `json:"inputType,omitempty"`
Tags []string `json:"tags,omitempty"`
Repository *Repository `json:"repository,omitempty"`
// script content - executor specific e.g. fo postman-collections executor
Content string `json:"content,omitempty"`
// script type
Type_ string `json:"type,omitempty"`
Content *ScriptContent `json:"content,omitempty"`
Created time.Time `json:"created,omitempty"`
// script tags
Tags []string `json:"tags,omitempty"`
}

0 comments on commit f212f13

Please sign in to comment.