framework

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package framework provides shared helpers for the qcloud e2e test suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Binary

func Binary() (string, error)

Binary returns the path to the qcloud binary to exercise. The binary is resolved exactly once per process:

  1. $QCLOUD_E2E_BINARY, if set.
  2. A cached download of the release named by $QCLOUD_E2E_RELEASE (default "latest"), verified against the release's checksums.txt.

Downloads are cached under os.UserCacheDir()/qcloud-e2e keyed by the archive sha256, so repeated test runs on the same host reuse the same binary.

Types

type Env

type Env struct {
	BinaryPath string
	APIKey     string
	AccountID  string
	Endpoint   string
	// contains filtered or unexported fields
}

Env bundles everything an e2e test needs to shell out to qcloud against a real Qdrant Cloud backend.

func NewEnv

func NewEnv(t *testing.T) *Env

NewEnv returns an Env wired up with credentials from the environment and an isolated empty config file. It skips the test if QCLOUD_E2E is not set.

The binary is the one returned by Binary; it is resolved once per process.

func (*Env) Redact

func (e *Env) Redact(s string) string

Redact masks the API key and JWT-like tokens in s. Useful when asserting against stdout/stderr.

func (*Env) Run

func (e *Env) Run(t *testing.T, args ...string) RunResult

Run invokes the binary with the given args and the default timeout, failing the test if the command exits non-zero. Stdout and stderr are streamed to t.Log.

func (*Env) RunAllowFail

func (e *Env) RunAllowFail(t *testing.T, args ...string) RunResult

RunAllowFail is like Run but returns the result without failing the test. Useful for commands where a non-zero exit is part of the assertion.

func (*Env) RunJSON

func (e *Env) RunJSON(t *testing.T, v any, args ...string)

RunJSON appends --json to args, runs the binary, and decodes stdout into v.

func (*Env) RunWithTimeout

func (e *Env) RunWithTimeout(t *testing.T, timeout time.Duration, args ...string) RunResult

RunWithTimeout is Run with a caller-supplied timeout.

type RunResult

type RunResult struct {
	Stdout   string
	Stderr   string
	ExitCode int
	Err      error
}

RunResult holds the outcome of a single binary invocation.

Jump to

Keyboard shortcuts

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