Skip to content

Commit

Permalink
fix: openapi spec for tests (#690)
Browse files Browse the repository at this point in the history
* fix: openapi spec for tests

* fix: openapi spec for tests output data

* fix: removed unnecessary todo items in code
  • Loading branch information
exu authored Jan 7, 2022
1 parent 24535a6 commit 448e17d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 17 deletions.
14 changes: 4 additions & 10 deletions api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ paths:
summary: "Create new test"
description: "Create new test action"
operationId: createTest
parameters:
- $ref: "#/components/parameters/Tags"
- $ref: "#/components/parameters/TextSearch"
requestBody:
$ref: "#/components/schemas/TestUpsertRequest"
responses:
Expand All @@ -64,20 +61,17 @@ paths:
description: "Returns array of tests"
operationId: listTests
parameters:
- $ref: "#/components/parameters/TextSearch"
- $ref: "#/components/parameters/PageSize"
- $ref: "#/components/parameters/PageIndex"
- $ref: "#/components/parameters/ExecutionsStatusFilter"
- $ref: "#/components/parameters/StartDateFilter"
- $ref: "#/components/parameters/EndDateFilter"
- $ref: "#/components/parameters/Tags"
- $ref: "#/components/parameters/TextSearch"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
type: array
items:
$ref: "#/components/schemas/Test"
500:
description: "problem with getting script executions from storage"
content:
Expand Down
1 change: 0 additions & 1 deletion internal/app/api/v1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func NewServer(
testsClient *testscr.TestsClient,
) TestKubeAPI {

// TODO consider moving to server pkg as some API_HTTPSERVER_ config prefix
var httpConfig server.Config
envconfig.Process("APISERVER", &httpConfig)

Expand Down
2 changes: 0 additions & 2 deletions pkg/api/v1/client/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func (c DirectScriptsAPI) UpdateScript(options UpsertScriptOptions) (script test
// ExecuteScript starts new external script execution, reads data and returns ID
// Execution is started asynchronously client can check later for results
func (c DirectScriptsAPI) ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error) {
// TODO call executor API - need to get parameters (what executor?) taken from CRD?
uri := c.getURI("/scripts/%s/executions", id)

// get script to get script tags
Expand Down Expand Up @@ -601,7 +600,6 @@ func (c DirectScriptsAPI) ListTests(namespace string, tags []string) (tests test

// ExecuteTest starts new external test execution, reads data and returns ID
func (c DirectScriptsAPI) ExecuteTest(id, namespace, executionName string, executionParams map[string]string) (execution testkube.TestExecution, err error) {
// TODO call executor API - need to get parameters (what executor?) taken from CRD?
uri := c.getURI("/tests/%s/executions", id)

request := testkube.TestExecutionRequest{
Expand Down
3 changes: 0 additions & 3 deletions pkg/api/v1/client/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func (c ProxyScriptsAPI) UpdateScript(options UpsertScriptOptions) (script testk
// ExecuteScript starts new external script execution, reads data and returns ID
// Execution is started asynchronously client can check later for results
func (c ProxyScriptsAPI) ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error) {
// TODO call executor API - need to get parameters (what executor?) taken from CRD?
uri := c.getURI("/scripts/%s/executions", id)

// get script to get script tags
Expand Down Expand Up @@ -479,7 +478,6 @@ func (c ProxyScriptsAPI) GetExecutionArtifacts(executionID string) (artifacts te
}

func (c ProxyScriptsAPI) DownloadFile(executionID, fileName, destination string) (artifact string, err error) {
// TODO consider use Query param for filename
uri := c.getURI("/executions/%s/artifacts/%s", executionID, url.QueryEscape(fileName))
req, err := c.GetProxy("GET").
Suffix(uri).
Expand Down Expand Up @@ -612,7 +610,6 @@ func (c ProxyScriptsAPI) getTestFromResponse(resp rest.Result) (test testkube.Te
// ExecuteTest starts new external test execution, reads data and returns ID
// Execution is started asynchronously client can check later for results
func (c ProxyScriptsAPI) ExecuteTest(id, namespace, executionName string, executionParams map[string]string) (execution testkube.TestExecution, err error) {
// TODO call executor API - need to get parameters (what executor?) taken from CRD?
uri := c.getURI("/tests/%s/executions", id)

request := testkube.ExecutionRequest{
Expand Down
1 change: 0 additions & 1 deletion pkg/executor/client/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type JobExecutor struct {
// Watch will get valid execution after async Execute, execution will be returned when success or error occurs
// Worker should set valid state for success or error after script completion
// TODO add timeout
// TODO rethink how to get real time logs
func (c JobExecutor) Watch(id string) (events chan ResultEvent) {
events = make(chan ResultEvent)

Expand Down

0 comments on commit 448e17d

Please sign in to comment.