detector

package
v1.6.25-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// Is detects based on upsert test options what kind of test it is
	Is(options apiClient.UpsertTestOptions) (string, bool)
	// IsTestName detecs if filename has a conventional test name
	IsTestName(filename string) (string, bool)
	// IsEnvName detecs if filename has a conventional env name
	IsEnvName(filename string) (string, string, bool)
	// IsSecretEnvName detecs if filename has a conventional secret env name
	IsSecretEnvName(filename string) (string, string, bool)
	// GetSecretVariables retuns secret variables
	GetSecretVariables(data string) (map[string]testkube.Variable, error)
	// GetType returns test type
	GetType() string
}

Adapter defines methods for test detection

type CurlTestAdapter

type CurlTestAdapter struct {
}

CurlTestAdapter is detector adapter for CURL like tests

func (CurlTestAdapter) GetSecretVariables added in v1.5.13

func (d CurlTestAdapter) GetSecretVariables(data string) (map[string]testkube.Variable, error)

GetSecretVariables retuns secret variables

func (CurlTestAdapter) GetType added in v1.5.13

func (d CurlTestAdapter) GetType() string

GetType returns test type

func (CurlTestAdapter) Is

func (d CurlTestAdapter) Is(options apiClient.UpsertTestOptions) (name string, ok bool)

Is detects based on upsert test options what kind of test it is

func (CurlTestAdapter) IsEnvName added in v1.5.13

func (d CurlTestAdapter) IsEnvName(filename string) (string, string, bool)

IsEnvName detecs if filename has a conventional env name

func (CurlTestAdapter) IsSecretEnvName added in v1.5.13

func (d CurlTestAdapter) IsSecretEnvName(filename string) (string, string, bool)

IsSecretEnvName detecs if filename has a conventional secret env name

func (CurlTestAdapter) IsTestName added in v1.5.13

func (d CurlTestAdapter) IsTestName(filename string) (string, bool)

IsTestName detecs if filename has a conventional test name

type Detector

type Detector struct {
	Adapters map[string]Adapter
}

Detector is detection orchestrator for possible detectors

func NewDefaultDetector

func NewDefaultDetector() Detector

func (*Detector) Add

func (d *Detector) Add(adapter Adapter)

Add adds adapter

func (*Detector) Detect

func (d *Detector) Detect(options client.UpsertTestOptions) (name string, found bool)

Detect detects test type

func (*Detector) DetectEnvName added in v1.5.13

func (d *Detector) DetectEnvName(filename string) (name, env, testType string, found bool)

DetectEnvName detects env name

func (*Detector) DetectSecretEnvName added in v1.5.13

func (d *Detector) DetectSecretEnvName(filename string) (name, env, testType string, found bool)

DetectSecretEnvName detecs secret env name

func (*Detector) DetectTestName added in v1.5.13

func (d *Detector) DetectTestName(filename string) (name, testType string, found bool)

DetectTestName detects test name

func (*Detector) GetAdapter added in v1.5.13

func (d *Detector) GetAdapter(testType string) Adapter

GetAdapter return adapter by test type

type EnvFile added in v1.5.13

type EnvFile struct {
	ID                   string    `json:"id"`
	Name                 string    `json:"name"`
	Values               []Value   `json:"values"`
	PostmanVariableScope string    `json:"_postman_variable_scope"`
	PostmanExportedAt    time.Time `json:"_postman_exported_at"`
	PostmanExportedUsing string    `json:"_postman_exported_using"`
}

EnvFile contains env file structure

type K6Adapter added in v1.0.4

type K6Adapter struct{}

K6Adapter is detector adapter for Postman collection saved as JSON content

func (K6Adapter) GetSecretVariables added in v1.5.13

func (d K6Adapter) GetSecretVariables(data string) (map[string]testkube.Variable, error)

GetSecretVariables retuns secret variables

func (K6Adapter) GetType added in v1.5.13

func (d K6Adapter) GetType() string

GetType returns test type

func (K6Adapter) Is added in v1.0.4

func (d K6Adapter) Is(options apiClient.UpsertTestOptions) (name string, ok bool)

Is detects based on upsert test options what kind of test it is

func (K6Adapter) IsEnvName added in v1.5.13

func (d K6Adapter) IsEnvName(filename string) (string, string, bool)

IsEnvName detecs if filename has a conventional env name

func (K6Adapter) IsSecretEnvName added in v1.5.13

func (d K6Adapter) IsSecretEnvName(filename string) (string, string, bool)

IsSecretEnvName detecs if filename has a conventional secret env name

func (K6Adapter) IsTestName added in v1.5.13

func (d K6Adapter) IsTestName(filename string) (string, bool)

IsTestName detecs if filename has a conventional test name

type PostmanCollectionAdapter

type PostmanCollectionAdapter struct {
}

PostmanCollectionAdapter is detector adapter for Postman collection saved as JSON content

func (PostmanCollectionAdapter) GetSecretVariables added in v1.5.13

func (d PostmanCollectionAdapter) GetSecretVariables(data string) (map[string]testkube.Variable, error)

GetSecretVariables retuns secret variables

func (PostmanCollectionAdapter) GetType added in v1.5.13

func (d PostmanCollectionAdapter) GetType() string

GetType returns test type

func (PostmanCollectionAdapter) Is

Is detects based on upsert test options what kind of test it is

func (PostmanCollectionAdapter) IsEnvName added in v1.5.13

func (d PostmanCollectionAdapter) IsEnvName(filename string) (string, string, bool)

IsEnvName detecs if filename has a conventional env name

func (PostmanCollectionAdapter) IsSecretEnvName added in v1.5.13

func (d PostmanCollectionAdapter) IsSecretEnvName(filename string) (string, string, bool)

IsSecretEnvName detecs if filename has a conventional secret env name

func (PostmanCollectionAdapter) IsTestName added in v1.5.13

func (d PostmanCollectionAdapter) IsTestName(filename string) (string, bool)

IsTestName detecs if filename has a conventional test name

type Value added in v1.5.13

type Value struct {
	Key     string `json:"key"`
	Value   string `json:"value"`
	Enabled bool   `json:"enabled"`
}

Value contains value structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL