Skip to content

Commit

Permalink
feat: [TKC-1055] test suite steps persistence (#219)
Browse files Browse the repository at this point in the history
* feat: test suite steps persistence

* fix: remove unused fields
  • Loading branch information
vLia authored Feb 23, 2024
1 parent c1770f0 commit 6396dbe
Show file tree
Hide file tree
Showing 15 changed files with 1,221 additions and 32 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) object:headerFile="pkg/tcl/header.txt" paths="./pkg/tcl/..."

fmt: ## Run go fmt against code.
go fmt ./...
Expand Down
14 changes: 14 additions & 0 deletions api/common/v1/args.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package v1

// ArgsModeType defines args mode type
// +kubebuilder:validation:Enum=append;override;replace
type ArgsModeType string

const (
// ArgsModeTypeAppend for append args mode
ArgsModeTypeAppend ArgsModeType = "append"
// ArgsModeTypeOverride for override args mode
ArgsModeTypeOverride ArgsModeType = "override"
// ArgsModeTypeReplace for replace args mode
ArgsModeTypeReplace ArgsModeType = "replace"
)
20 changes: 20 additions & 0 deletions api/common/v1/runningcontext.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v1

// RunningContext for test or test suite execution
type RunningContext struct {
// One of possible context types
Type_ RunningContextType `json:"type"`
// Context value depending from its type
Context string `json:"context,omitempty"`
}

type RunningContextType string

const (
RunningContextTypeUserCLI RunningContextType = "user-cli"
RunningContextTypeUserUI RunningContextType = "user-ui"
RunningContextTypeTestSuite RunningContextType = "testsuite"
RunningContextTypeTestTrigger RunningContextType = "testtrigger"
RunningContextTypeScheduler RunningContextType = "scheduler"
RunningContextTypeEmpty RunningContextType = ""
)
1 change: 1 addition & 0 deletions api/common/v1/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
corev1 "k8s.io/api/core/v1"
)

// +kubebuilder:object:generate=true
type Variable struct {
// variable type
Type_ string `json:"type,omitempty"`
Expand Down
40 changes: 40 additions & 0 deletions api/common/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 2 additions & 29 deletions api/tests/v3/test_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,7 @@ type ArtifactRequest struct {
SharedBetweenPods bool `json:"sharedBetweenPods,omitempty"`
}

// RunningContext for test or test suite execution
type RunningContext struct {
// One of possible context types
Type_ RunningContextType `json:"type"`
// Context value depending from its type
Context string `json:"context,omitempty"`
}

type RunningContextType string

const (
RunningContextTypeUserCLI RunningContextType = "user-cli"
RunningContextTypeUserUI RunningContextType = "user-ui"
RunningContextTypeTestSuite RunningContextType = "testsuite"
RunningContextTypeTestTrigger RunningContextType = "testtrigger"
RunningContextTypeScheduler RunningContextType = "scheduler"
RunningContextTypeEmpty RunningContextType = ""
)
type RunningContext commonv1.RunningContext

// pod request body
type PodRequest struct {
Expand Down Expand Up @@ -258,17 +241,7 @@ type ExecutionRequest struct {
}

// ArgsModeType defines args mode type
// +kubebuilder:validation:Enum=append;override;replace
type ArgsModeType string

const (
// ArgsModeTypeAppend for append args mode
ArgsModeTypeAppend ArgsModeType = "append"
// ArgsModeTypeOverride for override args mode
ArgsModeTypeOverride ArgsModeType = "override"
// ArgsModeTypeReplace for replace args mode
ArgsModeTypeReplace ArgsModeType = "replace"
)
type ArgsModeType commonv1.ArgsModeType

// Reference to env resource
type EnvReference struct {
Expand Down
4 changes: 3 additions & 1 deletion api/testsuite/v3/testsuite_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v3

import (
commonv1 "github.com/kubeshop/testkube-operator/api/common/v1"
"github.com/kubeshop/testkube-operator/pkg/tcl/testsuitestcl"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -52,7 +53,8 @@ type TestSuiteStepSpec struct {
// delay duration in time units
// +kubebuilder:validation:Type:=string
// +kubebuilder:validation:Format:=duration
Delay metav1.Duration `json:"delay,omitempty"`
Delay metav1.Duration `json:"delay,omitempty"`
ExecutionRequest *testsuitestcl.TestSuiteStepExecutionRequest `json:"executionRequest,omitempty"`
}

// options to download artifacts from previous steps
Expand Down
10 changes: 9 additions & 1 deletion api/testsuite/v3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6396dbe

Please sign in to comment.