Documentation
¶
Index ¶
- Constants
- Variables
- func AgentkInfoObj() *server_api.AgentkInfo
- func AgentwInfoObj() *server_api.AgentwInfo
- func AssertCommonRequestParams(t *testing.T, r *http.Request, traceID trace.TraceID)
- func AssertGetJSONRequest(t *testing.T, r *http.Request)
- func AssertGetJSONRequestIsCorrect(t *testing.T, r *http.Request, traceID trace.TraceID)
- func AssertGetRequestIsCorrect(t *testing.T, r *http.Request, traceID trace.TraceID)
- func AssertInvalid(t *testing.T, tests []InvalidTestcase)
- func AssertJWTSignature(t *testing.T, r *http.Request)
- func AssertRequestAccept(t *testing.T, r *http.Request, accept string)
- func AssertRequestAcceptJSON(t *testing.T, r *http.Request)
- func AssertRequestContentTypeJSON(t *testing.T, r *http.Request) bool
- func AssertRequestMethod(t *testing.T, r *http.Request, method string)
- func AssertRequestUserAgent(t *testing.T, r *http.Request, userAgent string)
- func AssertValid(t *testing.T, tests []ValidTestcase)
- func CtxWithSpanContext(t *testing.T) (context.Context, trace.TraceID)
- func GenerateCACert(t *testing.T) (string, string, *x509.Certificate, crypto.PrivateKey)
- func GenerateCert(t *testing.T, name string, caCert *x509.Certificate, caKey crypto.PrivateKey) (string, string)
- func GenerateCertInMem(t *testing.T, name string, caCert *x509.Certificate, caKey crypto.PrivateKey) ([]byte, []byte)
- func InjectSpanContext(t *testing.T, ctx context.Context) (context.Context, trace.TraceID)
- func Never(t testing.TB, condition func() bool, waitFor, tick time.Duration)
- func NewPollConfig(interval time.Duration) retry.PollConfig
- func ReadProtoJSONRequest(t *testing.T, r *http.Request, m proto.Message) bool
- func RecvMsg(value any) func(any) error
- func RespondWithJSON(t *testing.T, w http.ResponseWriter, response any)
- func RespondWithJSONAndStatus(t *testing.T, w http.ResponseWriter, statusCode int, response any)
- func RunnerControllerInfoObj() *server_api.RunnerControllerInfo
- func SetValue(target, value any)
- func SkipNotIntegration(t testing.TB)
- type InvalidTestcase
- type ValidTestcase
Constants ¶
View Source
const ( KASUserAgent = "kas/v0.1-blabla/asdwd" AgentToken api.AgentToken = "123123" AuthSecretKey = "blablabla" ProjectID int64 = 321 UserID int64 = 456 ConfigProjectID int64 = 5 )
Variables ¶
View Source
var ( AgentkKey1 = api.AgentKey{ ID: 123, Type: api.AgentTypeKubernetes, } AgentkKey2 = api.AgentKey{ ID: 456, Type: api.AgentTypeKubernetes, } AgentwKey1 = api.AgentKey{ ID: 1123, Type: api.AgentTypeWorkspace, } RunnerControllerKey1 = api.AgentKey{ ID: 2102, Type: api.AgentTypeRunnerController, } RunnerKey1 = api.AgentKey{ ID: 3333, Type: api.AgentTypeRunner, } )
View Source
var Marshaler = &prototool.ValidatingMarshaler{Validator: prototool.MessageNameValidator{Delegate: Validator}}
Marshaler is the shared validating marshaler for use in tests.
View Source
var Validator = protovalidate.GlobalValidator
Validator is the shared protovalidate validator for use in tests. Use this instead of protovalidate.GlobalValidator directly.
Functions ¶
func AgentkInfoObj ¶
func AgentkInfoObj() *server_api.AgentkInfo
func AgentwInfoObj ¶
func AgentwInfoObj() *server_api.AgentwInfo
func AssertInvalid ¶
func AssertInvalid(t *testing.T, tests []InvalidTestcase)
func AssertRequestUserAgent ¶
func AssertValid ¶
func AssertValid(t *testing.T, tests []ValidTestcase)
func GenerateCACert ¶
func GenerateCACert(t *testing.T) (string, string, *x509.Certificate, crypto.PrivateKey)
func GenerateCert ¶
func GenerateCert(t *testing.T, name string, caCert *x509.Certificate, caKey crypto.PrivateKey) (string, string)
func GenerateCertInMem ¶
func GenerateCertInMem(t *testing.T, name string, caCert *x509.Certificate, caKey crypto.PrivateKey) ([]byte, []byte)
func InjectSpanContext ¶
func Never ¶ added in v19.4.0
Never fails the test if condition returns true before waitFor elapses, checking it immediately and then once per tick. condition runs on the calling goroutine, so it may assert with t and use t.Context(). testify's Never runs it on a goroutine that can outlive the test.
func NewPollConfig ¶
func NewPollConfig(interval time.Duration) retry.PollConfig
func ReadProtoJSONRequest ¶
func RespondWithJSON ¶
func RespondWithJSON(t *testing.T, w http.ResponseWriter, response any)
RespondWithJSON marshals response into JSON and writes it into w.
func RunnerControllerInfoObj ¶
func RunnerControllerInfoObj() *server_api.RunnerControllerInfo
func SetValue ¶
func SetValue(target, value any)
SetValue sets target to value with special handling for proto.Message. target must be a pointer. i.e. *blaProtoMsgType value must be of the same type as target.
func SkipNotIntegration ¶
Types ¶
type InvalidTestcase ¶
type ValidTestcase ¶
Click to show internal directories.
Click to hide internal directories.