helper

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: BSD-3-Clause Imports: 45 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	MinPollInterval = 100 * time.Millisecond // Minimun interval for polling backup status.
	MaxDeadline     = 10 * time.Minute       // Maxium timeout for polling backup status.
)

Variables ¶

View Source
var (
	ServerPort     string
	ServerHost     string
	ServerGRPCPort string
	ServerGRPCHost string
	ServerScheme   string
	DebugHTTP      bool
)

Configuration flags provided by the user that runs an acceptance test.

View Source
var RaceDetectorEnabled = false

Credentials for the root key

Functions ¶

func ActivateTenants ¶ added in v1.37.0

func ActivateTenants(t *testing.T, class string, tenants []string)

func ActivateUser ¶ added in v1.30.0

func ActivateUser(t *testing.T, key, userId string)

func AddPermissions ¶ added in v1.28.0

func AddPermissions(t *testing.T, key, role string, permissions ...*models.Permission)

func AddReference ¶

func AddReference(t *testing.T, object *models.Object, ref *models.SingleRef, prop string)

func AddReferenceReturn ¶ added in v1.30.1

func AddReferenceReturn(t *testing.T, ref *models.SingleRef, id strfmt.UUID, class, prop, tenant string, auth runtime.ClientAuthInfoWriter) (*objects.ObjectsClassReferencesCreateOK, error)

func AddReferenceTenant ¶ added in v1.20.0

func AddReferenceTenant(t *testing.T, object *models.Object, ref *models.SingleRef, prop string, tenant string)

func AddReferences ¶

func AddReferences(t *testing.T, refs []*models.BatchReference) ([]*models.BatchReferenceResponse, error)

func AddReferencesCL ¶ added in v1.37.0

func AssertCreateObject ¶

func AssertCreateObject(t *testing.T, className string, schema map[string]interface{}) strfmt.UUID

func AssertCreateObjectClass ¶

func AssertCreateObjectClass(t *testing.T, class *models.Class)

func AssertCreateObjectTenantVector ¶ added in v1.29.9

func AssertCreateObjectTenantVector(t *testing.T, className string, schema map[string]interface{}, tenant string, vector []float32) strfmt.UUID

func AssertDeleteObjectClass ¶

func AssertDeleteObjectClass(t *testing.T, class string)

func AssertEventuallyEqual ¶

func AssertEventuallyEqual(t *testing.T, expected interface{}, actualThunk func() interface{}, msg ...interface{})

AssertEventuallyEqual retries the 'actual' thunk every 10ms for a total of 300ms. If a single one succeeds, it returns, if all fails it eventually fails

func AssertEventuallyEqualWithFrequencyAndTimeout ¶

func AssertEventuallyEqualWithFrequencyAndTimeout(t *testing.T, expected interface{}, actualThunk func() interface{},
	interval time.Duration, timeout time.Duration, msg ...interface{},
)

func AssertGetObject ¶

func AssertGetObject(t *testing.T, class string, uuid strfmt.UUID, include ...string) *models.Object

func AssertGetObjectEventually ¶

func AssertGetObjectEventually(t *testing.T, class string, uuid strfmt.UUID) *models.Object

func AssertGetObjectFailsEventually ¶

func AssertGetObjectFailsEventually(t *testing.T, class string, uuid strfmt.UUID) error

func AssertRequestFail ¶

func AssertRequestFail(t *testing.T, response interface{}, err error, checkFn func())

Asserts that the request _did_ return an error. Optionally perform some checks only if the request failed

func AssertRequestOk ¶

func AssertRequestOk(t *testing.T, response interface{}, err error, checkFn func())

Asserts that the request did not return an error. Optionally perform some checks only if the request did not fail

func AssignRoleToGroup ¶ added in v1.28.5

func AssignRoleToGroup(t *testing.T, key, role, group string)

func AssignRoleToUser ¶ added in v1.28.0

func AssignRoleToUser(t *testing.T, key, role, user string)

func AssignRoleToUserOIDC ¶ added in v1.30.0

func AssignRoleToUserOIDC(t *testing.T, key, role, user string)

func BatchClient ¶

func BatchClient(t *testing.T) batch.ClientService

Create a client that logs with t.Logf, if a *testing.T is provided. If there is no test case at hand, pass in nil to disable logging.

func CallToolOnce ¶ added in v1.37.0

func CallToolOnce[I any, O any](ctx context.Context, t *testing.T, tool string, in I, out *O, apiKey string) error

CallToolOnce calls an MCP tool once with the default admin-key authentication

func CancelBackup ¶ added in v1.24.25

func CancelBackup(t *testing.T, backend, backupID string) error

func CancelBackupWithAuthz ¶ added in v1.28.0

func CancelBackupWithAuthz(t *testing.T, backend, backupID string, authInfo runtime.ClientAuthInfoWriter) error

func CertaintyToDist ¶

func CertaintyToDist(t *testing.T, in float32) float32

func CheckObjectsBatchResponse ¶ added in v1.20.0

func CheckObjectsBatchResponse(t *testing.T, resp []*models.ObjectsGetResponse, err error)

func CheckReferencesBatchResponse ¶ added in v1.20.0

func CheckReferencesBatchResponse(t *testing.T, resp []*models.BatchReferenceResponse, err error)

func Client ¶

func Client(t *testing.T) *apiclient.Weaviate

Create a client that logs with t.Logf, if a *testing.T is provided. If there is no test case at hand, pass in nil to disable logging.

func ClientGRPC ¶ added in v1.26.0

func ClientGRPC(t *testing.T) pb.WeaviateClient

func CreateAlias ¶ added in v1.32.0

func CreateAlias(t *testing.T, alias *models.Alias)

func CreateAliasAuth ¶ added in v1.32.0

func CreateAliasAuth(t *testing.T, alias *models.Alias, key string)

func CreateAliasAuthWithReturn ¶ added in v1.38.0

func CreateAliasAuthWithReturn(t *testing.T, alias *models.Alias, key string) (*schema.AliasesCreateOK, error)

CreateAliasAuthWithReturn issues an authenticated alias-create and returns the raw response/error so the caller can assert on rejection paths.

func CreateAliasWithAuthz ¶ added in v1.32.0

func CreateAliasWithAuthz(t *testing.T, alias *models.Alias, authInfo runtime.ClientAuthInfoWriter)

func CreateAliasWithReturn ¶ added in v1.32.0

func CreateAliasWithReturn(t *testing.T, alias *models.Alias) (*schema.AliasesCreateOK, error)

func CreateAuth ¶

func CreateAuth(apiKey string) runtime.ClientAuthInfoWriterFunc

Create a auth writer for the Weaviate client with a specific key

func CreateBackup ¶

func CreateBackup(t *testing.T, cfg *models.BackupConfig, className, backend, backupID string) (*backups.BackupsCreateOK, error)

func CreateBackupStatus ¶

func CreateBackupStatus(t *testing.T, backend, backupID, overrideBucket, overridePath string) (*backups.BackupsCreateStatusOK, error)

func CreateBackupStatusWithAuthz ¶ added in v1.28.0

func CreateBackupStatusWithAuthz(t *testing.T, backend, backupID, overrideBucket, overridePath string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsCreateStatusOK, error)

func CreateBackupWithAuthz ¶ added in v1.28.0

func CreateBackupWithAuthz(t *testing.T, cfg *models.BackupConfig, className, backend, backupID string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsCreateOK, error)

func CreateBackupWithBase ¶ added in v1.34.18

func CreateBackupWithBase(t *testing.T, cfg *models.BackupConfig, className, backend, backupID, baseBackupID string) (*backups.BackupsCreateOK, error)

func CreateBackupWithBaseAndAuthz ¶ added in v1.37.6

func CreateBackupWithBaseAndAuthz(t *testing.T, cfg *models.BackupConfig, className, backend, backupID, baseBackupID string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsCreateOK, error)

func CreateClass ¶

func CreateClass(t *testing.T, class *models.Class)

func CreateClassAuth ¶ added in v1.28.0

func CreateClassAuth(t *testing.T, class *models.Class, key string)

func CreateClassAuthWithReturn ¶ added in v1.38.0

func CreateClassAuthWithReturn(t *testing.T, class *models.Class, key string) (*schema.SchemaObjectsCreateOK, error)

CreateClassAuthWithReturn issues an authenticated class-create and returns the raw response/error so the caller can assert on rejection paths.

func CreateGrpcConnectionClient ¶ added in v1.22.0

func CreateGrpcConnectionClient(host string) (*grpc.ClientConn, error)

func CreateGrpcWeaviateClient ¶ added in v1.22.0

func CreateGrpcWeaviateClient(conn *grpc.ClientConn) pb.WeaviateClient

func CreateNamespace ¶ added in v1.38.0

func CreateNamespace(t *testing.T, name, key string) *models.Namespace

CreateNamespace creates the namespace and blocks until a follow-up GET succeeds. On multi-node clusters RAFT replication can lag a few hundred milliseconds behind the CreateNamespace response; callers should be able to use the namespace immediately on return.

func CreateNamespaceWithHomeNode ¶ added in v1.38.0

func CreateNamespaceWithHomeNode(t *testing.T, name, homeNode, key string) *models.Namespace

CreateNamespaceWithHomeNode creates a namespace pinned to homeNode. When homeNode is empty, the cluster picks one automatically.

func CreateObject ¶

func CreateObject(t *testing.T, object *models.Object) error

func CreateObjectAuth ¶ added in v1.28.0

func CreateObjectAuth(t *testing.T, object *models.Object, key string) error

func CreateObjectCL ¶ added in v1.18.0

func CreateObjectCL(t *testing.T, object *models.Object, cl types.ConsistencyLevel) error

func CreateObjectWithResponse ¶ added in v1.25.2

func CreateObjectWithResponse(t *testing.T, object *models.Object) (*models.Object, error)

func CreateObjectWithResponseAuth ¶ added in v1.37.0

func CreateObjectWithResponseAuth(t *testing.T, object *models.Object, key string) (*models.Object, error)

func CreateObjectWithTimeout ¶ added in v1.31.11

func CreateObjectWithTimeout(t *testing.T, object *models.Object, timeout time.Duration) error

func CreateObjectsBatch ¶

func CreateObjectsBatch(t *testing.T, objects []*models.Object)

func CreateObjectsBatchAuth ¶ added in v1.28.0

func CreateObjectsBatchAuth(t *testing.T, objects []*models.Object, key string)

func CreateObjectsBatchCL ¶ added in v1.26.0

func CreateObjectsBatchCL(t *testing.T, objects []*models.Object, cl types.ConsistencyLevel)

func CreateObjectsBatchWithResponse ¶ added in v1.32.0

func CreateObjectsBatchWithResponse(t *testing.T, objects []*models.Object) []*models.ObjectsGetResponse

func CreateRole ¶ added in v1.28.0

func CreateRole(t *testing.T, key string, role *models.Role)

func CreateRoleAndAssign ¶ added in v1.38.0

func CreateRoleAndAssign(t *testing.T, adminKey, userName, roleName string, permissions ...*models.Permission)

CreateRoleAndAssign creates a role with the given permissions, assigns it to an already-existing user, and registers a t.Cleanup that reverses both (revoke role then delete role). The user is not created or deleted here — callers are expected to declare users statically on the compose (see docker.WithUserApiKey).

func CreateTenants ¶ added in v1.20.0

func CreateTenants(t *testing.T, class string, tenants []*models.Tenant)

func CreateTenantsAuth ¶ added in v1.28.0

func CreateTenantsAuth(t *testing.T, class string, tenants []*models.Tenant, key string)

func CreateTenantsReturnError ¶ added in v1.20.0

func CreateTenantsReturnError(t *testing.T, class string, tenants []*models.Tenant) error

func CreateUser ¶ added in v1.30.0

func CreateUser(t *testing.T, userId, key string) string

func CreateUserWithApiKey ¶ added in v1.30.10

func CreateUserWithApiKey(t *testing.T, userId, key string, createdAt *time.Time) string

func CreateUserWithNamespace ¶ added in v1.38.0

func CreateUserWithNamespace(t *testing.T, userId, namespace, adminKey string) string

func DeactivateTenants ¶ added in v1.37.0

func DeactivateTenants(t *testing.T, class string, tenants []string)

func DeactivateUser ¶ added in v1.30.0

func DeactivateUser(t *testing.T, key, userId string, revokeKey bool)

func DefaultBackupConfig ¶ added in v1.24.0

func DefaultBackupConfig() *models.BackupConfig

func DefaultRestoreConfig ¶ added in v1.24.0

func DefaultRestoreConfig() *models.RestoreConfig

func DeleteAlias ¶ added in v1.32.0

func DeleteAlias(t *testing.T, aliasName string)

func DeleteAliasAuthWithReturn ¶ added in v1.38.0

func DeleteAliasAuthWithReturn(t *testing.T, aliasName, key string) (*schema.AliasesDeleteNoContent, error)

DeleteAliasAuthWithReturn issues an authenticated alias-delete and returns the raw response/error so the caller can assert on rejection paths (e.g. malformed namespace prefix).

func DeleteAliasWithAuthz ¶ added in v1.32.0

func DeleteAliasWithAuthz(t *testing.T, aliasName string, authInfo runtime.ClientAuthInfoWriter)

func DeleteAliasWithReturn ¶ added in v1.32.0

func DeleteAliasWithReturn(t *testing.T, aliasName string) (*schema.AliasesDeleteNoContent, error)

func DeleteClass ¶

func DeleteClass(t *testing.T, class string)

func DeleteClassAuth ¶ added in v1.30.0

func DeleteClassAuth(t *testing.T, class string, key string)

func DeleteClassAuthWithReturn ¶ added in v1.38.0

func DeleteClassAuthWithReturn(t *testing.T, class string, key string) error

DeleteClassAuthWithReturn issues an authenticated class-delete and returns the raw error so callers can assert on rejection (e.g. malformed namespace prefix in the URL).

func DeleteClassObject ¶

func DeleteClassObject(t *testing.T, class string) (*schema.SchemaObjectsDeleteOK, error)

func DeleteClassWithAuthz ¶ added in v1.28.0

func DeleteClassWithAuthz(t *testing.T, class string, authInfo runtime.ClientAuthInfoWriter)

func DeleteClassWithoutAssert ¶ added in v1.38.0

func DeleteClassWithoutAssert(t *testing.T, class, key string)

DeleteClassWithoutAssert deletes a class without asserting on the result. Use it for best-effort cleanup where the class may already have been removed by another path (e.g. a cascading namespace delete).

func DeleteNamespace ¶ added in v1.38.0

func DeleteNamespace(t *testing.T, name, key string, opts ...DeleteNamespaceOption)

DeleteNamespace marks a namespace for deletion. The delete returns HTTP 202; by default the helper then polls Get until 404 so callers can treat removal as complete. Pass WithoutWaitForCleanup to skip the polling.

func DeleteObject ¶

func DeleteObject(t *testing.T, object *models.Object)

func DeleteObjectCL ¶ added in v1.24.18

func DeleteObjectCL(t *testing.T, class string, id strfmt.UUID, cl types.ConsistencyLevel)

func DeleteObjectsBatch ¶

func DeleteObjectsBatch(t *testing.T, body *models.BatchDelete, cl types.ConsistencyLevel)

func DeleteObjectsBatchWithResponse ¶ added in v1.32.0

func DeleteObjectsBatchWithResponse(t *testing.T, body *models.BatchDelete, cl types.ConsistencyLevel) *models.BatchDeleteResponse

func DeleteReference ¶

func DeleteReference(t *testing.T, object *models.Object, ref *models.SingleRef, prop string)

func DeleteReferenceReturn ¶ added in v1.30.1

func DeleteReferenceReturn(t *testing.T, ref *models.SingleRef, id strfmt.UUID, class, prop, tenant string, auth runtime.ClientAuthInfoWriter) (*objects.ObjectsClassReferencesDeleteNoContent, error)

func DeleteReferenceTenant ¶ added in v1.20.0

func DeleteReferenceTenant(t *testing.T, object *models.Object, ref *models.SingleRef, prop string, tenant string)

func DeleteRole ¶ added in v1.28.0

func DeleteRole(t *testing.T, key, role string)

func DeleteTenantObject ¶ added in v1.20.0

func DeleteTenantObject(t *testing.T, class string, id strfmt.UUID, tenant string, cl types.ConsistencyLevel)

func DeleteTenantObjectsBatch ¶ added in v1.20.0

func DeleteTenantObjectsBatch(t *testing.T, body *models.BatchDelete,
	tenant string,
) (*models.BatchDeleteResponse, error)

func DeleteTenantObjectsBatchCL ¶ added in v1.24.18

func DeleteTenantObjectsBatchCL(t *testing.T, body *models.BatchDelete,
	tenant string, cl types.ConsistencyLevel,
) (*models.BatchDeleteResponse, error)

func DeleteTenants ¶ added in v1.20.0

func DeleteTenants(t *testing.T, class string, tenants []string) error

func DeleteTenantsWithContext ¶ added in v1.26.14

func DeleteTenantsWithContext(t *testing.T, ctx context.Context, class string, tenants []string) error

func DeleteUser ¶ added in v1.30.0

func DeleteUser(t *testing.T, userId, key string)

func EnablePQ ¶ added in v1.22.4

func EnablePQ(t *testing.T, className string, pq map[string]interface{})

func ExpectBackupEventuallyCreated ¶ added in v1.33.0

func ExpectBackupEventuallyCreated(t *testing.T, backupID, backend string, authz runtime.ClientAuthInfoWriter, opts ...BackupExpectOpt)

Expect creation status to report SUCCESS within 30s and with 500ms polling interval (default). Change polling configuration by passing WithPollInterval and WithDeadline. To use in no-authz context, pass nil to the authz parameter.

func ExpectBackupEventuallyRestored ¶ added in v1.33.0

func ExpectBackupEventuallyRestored(t *testing.T, backupID, backend string, authz runtime.ClientAuthInfoWriter, opts ...BackupExpectOpt)

Expect restore status to report SUCCESS within 30s and with 500ms polling interval (default). Change polling configuration by passing WithPollInterval and WithDeadline. To use in no-authz context, pass nil to the authz parameter.

func GetAlias ¶ added in v1.32.0

func GetAlias(t *testing.T, aliasName string) *models.Alias

func GetAliasAuthWithReturn ¶ added in v1.38.0

func GetAliasAuthWithReturn(t *testing.T, aliasName, key string) (*schema.AliasesGetAliasOK, error)

GetAliasAuthWithReturn issues an authenticated alias-get and returns the raw response/error so the caller can assert on rejection paths (e.g. malformed namespace prefix).

func GetAliasNotFound ¶ added in v1.32.0

func GetAliasNotFound(t *testing.T, aliasName string) *models.Alias

func GetAliasWithAuthz ¶ added in v1.32.0

func GetAliasWithAuthz(t *testing.T, aliasName string, authInfo runtime.ClientAuthInfoWriter) *models.Alias

func GetAliasWithAuthzNotFound ¶ added in v1.32.0

func GetAliasWithAuthzNotFound(t *testing.T, aliasName string, authInfo runtime.ClientAuthInfoWriter) *models.Alias

func GetAliases ¶ added in v1.32.0

func GetAliases(t *testing.T, className *string) *models.AliasResponse

func GetAliasesAuthWithReturn ¶ added in v1.38.0

func GetAliasesAuthWithReturn(t *testing.T, className *string, key string) (*schema.AliasesGetOK, error)

GetAliasesAuthWithReturn issues an authenticated alias-list and returns the raw response/error so the caller can assert on rejection paths (e.g. malformed namespace prefix on the class filter).

func GetAliasesWithAuthz ¶ added in v1.32.0

func GetAliasesWithAuthz(t *testing.T, className *string, authInfo runtime.ClientAuthInfoWriter) *models.AliasResponse

func GetBase64EncodedData ¶ added in v1.27.12

func GetBase64EncodedData(path string) (string, error)

Helper methods get image and video blob fns

func GetClass ¶

func GetClass(t *testing.T, class string) *models.Class

func GetClassAuth ¶ added in v1.30.10

func GetClassAuth(t *testing.T, class string, key string) *models.Class

func GetClassAuthWithReturn ¶ added in v1.38.0

func GetClassAuthWithReturn(t *testing.T, class string, key string) (*schema.SchemaObjectsGetOK, error)

GetClassAuthWithReturn issues an authenticated class-get and returns the raw response/error. Useful for asserting that a deleted/never-existed class is reported missing.

func GetClassWithoutAssert ¶ added in v1.25.27

func GetClassWithoutAssert(t *testing.T, class, key string) (*models.Class, error)

GetClassWithoutAssert fetches a class without asserting on the result. An empty key skips authentication; otherwise the call is made with the given API key.

func GetGroupsForRole ¶ added in v1.32.5

func GetGroupsForRole(t *testing.T, key, roleName string) []string

func GetInfoForOwnUser ¶ added in v1.28.5

func GetInfoForOwnUser(t *testing.T, key string) *models.UserOwnInfo

func GetKnownGroups ¶ added in v1.32.5

func GetKnownGroups(t *testing.T, key string) []string

func GetMeta ¶ added in v1.20.0

func GetMeta(t *testing.T) *models.Meta

func GetNamespace ¶ added in v1.38.0

func GetNamespace(t *testing.T, name, key string) *models.Namespace

func GetObject ¶

func GetObject(t *testing.T, class string, uuid strfmt.UUID, include ...string) (*models.Object, error)

func GetObjectAuth ¶ added in v1.37.0

func GetObjectAuth(t *testing.T, class string, uuid strfmt.UUID, key string, include ...string) (*models.Object, error)

func GetObjectAuthWithTenant ¶ added in v1.37.0

func GetObjectAuthWithTenant(t *testing.T, class string, uuid strfmt.UUID, tenant string, key string, include ...string) (*models.Object, error)

func GetObjectCL ¶ added in v1.18.0

func GetObjectCL(t *testing.T, class string, uuid strfmt.UUID,
	cl types.ConsistencyLevel, include ...string,
) (*models.Object, error)

func GetObjectFromNode ¶

func GetObjectFromNode(t *testing.T, class string, uuid strfmt.UUID, nodename string) (*models.Object, error)

func GetObjectFromNodeWithVector ¶ added in v1.34.10

func GetObjectFromNodeWithVector(t *testing.T, class string, uuid strfmt.UUID, nodename string) (*models.Object, error)

func GetObjects ¶ added in v1.35.0

func GetObjects(t *testing.T, class string, include ...string) ([]*models.Object, error)

func GetOneTenant ¶ added in v1.28.0

func GetOneTenant(t *testing.T, class, tenant string) (*schema.TenantsGetOneOK, error)

func GetRandomString ¶

func GetRandomString(length int) string

GetRandomString returns a string comprised of random samplings of charset, of length specified by caller

func GetRoleByName ¶ added in v1.28.0

func GetRoleByName(t *testing.T, key, role string) *models.Role

func GetRoles ¶ added in v1.28.0

func GetRoles(t *testing.T, key string) []*models.Role

func GetRolesForGroup ¶ added in v1.32.5

func GetRolesForGroup(t *testing.T, key, group string, includeRoles bool) []*models.Role

func GetRolesForUser ¶ added in v1.28.0

func GetRolesForUser(t *testing.T, user, key string, includeRoles bool) []*models.Role

func GetRolesForUserOIDC ¶ added in v1.30.0

func GetRolesForUserOIDC(t *testing.T, user, key string) []*models.Role

func GetTenantObjectFromNode ¶ added in v1.20.0

func GetTenantObjectFromNode(t *testing.T, class string, uuid strfmt.UUID, nodename, tenant string) (*models.Object, error)

func GetTenants ¶ added in v1.20.0

func GetTenants(t *testing.T, class string) (*schema.TenantsGetOK, error)

func GetTenantsGRPC ¶ added in v1.26.0

func GetTenantsGRPC(t *testing.T, class string) (*pb.TenantsGetReply, error)

func GetTenantsWithAuthz ¶ added in v1.28.5

func GetTenantsWithAuthz(t *testing.T, class string, authInfo runtime.ClientAuthInfoWriter) (*schema.TenantsGetOK, error)

func GetUser ¶ added in v1.30.0

func GetUser(t *testing.T, userId, key string) *models.DBUserInfo

func GetUserForRoles ¶ added in v1.30.0

func GetUserForRoles(t *testing.T, roleName, key string) []string

func GetUserForRolesBoth ¶ added in v1.30.0

func GetUserForRolesBoth(t *testing.T, roleName, key string) []*authz.GetUsersForRoleOKBodyItems0

func GetUserWithLastUsedTime ¶ added in v1.30.1

func GetUserWithLastUsedTime(t *testing.T, userId, key string, lastUsedTime bool) *models.DBUserInfo

func GetWeaviateGRPCURL ¶ added in v1.27.0

func GetWeaviateGRPCURL() string

func GetWeaviateURL ¶

func GetWeaviateURL() string

func HeadObject ¶ added in v1.32.0

func HeadObject(t *testing.T, id strfmt.UUID) error

func IntToUUID ¶ added in v1.19.8

func IntToUUID(in uint64) strfmt.UUID

InToUUID takes an unsigned int64 and places it in BigEndian fashion into the upper 8 bytes of a 16 byte UUID. This makes it easy to produce easy-to-read UUIDs in test scenarios. For example:

IntToUUID(1)
// returns "00000000-0000-0000-0000-000000000001"

func ListAllUsers ¶ added in v1.30.0

func ListAllUsers(t *testing.T, key string) []*models.DBUserInfo

func ListAllUsersWithIncludeTime ¶ added in v1.30.1

func ListAllUsersWithIncludeTime(t *testing.T, key string, includeLastUsedTime bool) []*models.DBUserInfo

func ListBackup ¶ added in v1.24.25

func ListBackup(t *testing.T, backend string) (*backups.BackupsListOK, error)

func ListBackupsWithAuthz ¶ added in v1.28.0

func ListBackupsWithAuthz(t *testing.T, backend string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsListOK, error)

func ListNamespaces ¶ added in v1.38.0

func ListNamespaces(t *testing.T, key string) []*models.Namespace

func ListObjects ¶ added in v1.20.0

func ListObjects(t *testing.T, class string) (*models.ObjectsListResponse, error)

func ListObjectsAuth ¶ added in v1.34.0

func ListObjectsAuth(t *testing.T, class string, key string) (*models.ObjectsListResponse, error)

func NewBeacon ¶ added in v1.20.0

func NewBeacon(className string, id strfmt.UUID) strfmt.URI

func NewClient ¶ added in v1.32.15

func NewClient(t *testing.T, uri string) *client.Weaviate

NewClient creates a new immutable client configured for the given URI. This function does not modify global state and is safe to use in concurrent tests. The URI can optionally include a scheme (e.g., "http://localhost:8080" or "localhost:8080"). Use this instead of SetupClient() + Client() to avoid data races when tests use goroutines that concurrently access the client.

func ObjectContentsProp ¶ added in v1.25.13

func ObjectContentsProp(contents string) map[string]interface{}

func ObjectExistsCL ¶ added in v1.18.0

func ObjectExistsCL(t *testing.T, class string, id strfmt.UUID, cl types.ConsistencyLevel) (bool, error)

func OperationsClient ¶

func OperationsClient(t *testing.T) operations_apiclient.ClientService

Create a client that logs with t.Logf, if a *testing.T is provided. If there is no test case at hand, pass in nil to disable logging.

func PatchObject ¶

func PatchObject(t *testing.T, object *models.Object) error

func PatchObjectCL ¶ added in v1.34.10

func PatchObjectCL(t *testing.T, object *models.Object, cl types.ConsistencyLevel) error

func RemovePermissions ¶ added in v1.30.0

func RemovePermissions(t *testing.T, key, role string, permissions ...*models.Permission)

func ReplaceReferencesReturn ¶ added in v1.30.1

func ReplaceReferencesReturn(t *testing.T, refs []*models.SingleRef, id strfmt.UUID, class, prop, tenant string, auth runtime.ClientAuthInfoWriter) (*objects.ObjectsClassReferencesPutOK, error)

func ResetClient ¶ added in v1.25.0

func ResetClient()

func RestoreBackup ¶

func RestoreBackup(t *testing.T, cfg *models.RestoreConfig, className, backend, backupID string, nodeMapping map[string]string, overwriteAlias bool) (*backups.BackupsRestoreOK, error)

func RestoreBackupStatus ¶

func RestoreBackupStatus(t *testing.T, backend, backupID, overrideBucket, overridePath string) (*backups.BackupsRestoreStatusOK, error)

func RestoreBackupStatusWithAuthz ¶ added in v1.28.0

func RestoreBackupStatusWithAuthz(t *testing.T, backend, backupID, overrideBucket, overridePath string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsRestoreStatusOK, error)

func RestoreBackupWithAuthz ¶ added in v1.28.0

func RestoreBackupWithAuthz(t *testing.T, cfg *models.RestoreConfig, className, backend, backupID string, nodeMapping map[string]string, authInfo runtime.ClientAuthInfoWriter) (*backups.BackupsRestoreOK, error)

func RevokeRoleFromGroup ¶ added in v1.28.5

func RevokeRoleFromGroup(t *testing.T, key, role, group string)

func RevokeRoleFromUser ¶ added in v1.28.3

func RevokeRoleFromUser(t *testing.T, key, role, user string)

func RevokeRoleFromUserOIDC ¶ added in v1.38.0

func RevokeRoleFromUserOIDC(t *testing.T, key, role, user string)

func RotateKey ¶ added in v1.30.0

func RotateKey(t *testing.T, userId, key string) string

func SetupClient ¶

func SetupClient(uri string)

func SetupGRPCClient ¶ added in v1.26.0

func SetupGRPCClient(t *testing.T, uri string)

func TenantExists ¶ added in v1.25.0

func TenantExists(t *testing.T, class string, tenant string) (*schema.TenantExistsOK, error)

func TenantListObjects ¶ added in v1.20.0

func TenantListObjects(t *testing.T, class string, tenant string) (*models.ObjectsListResponse, error)

func TenantObject ¶ added in v1.20.0

func TenantObject(t *testing.T, class string, id strfmt.UUID, tenant string) (*models.Object, error)

func TenantObjectExists ¶ added in v1.20.0

func TenantObjectExists(t *testing.T, class string, id strfmt.UUID, tenant string) (bool, error)

func TenantObjectWithInclude ¶ added in v1.21.0

func TenantObjectWithInclude(t *testing.T, class string, id strfmt.UUID, tenant string, includes string) (*models.Object, error)

func UpdateAlias ¶ added in v1.32.0

func UpdateAlias(t *testing.T, aliasName, targetClassName string)

func UpdateAliasAuthWithReturn ¶ added in v1.38.0

func UpdateAliasAuthWithReturn(t *testing.T, aliasName, targetClassName, key string) (*schema.AliasesUpdateOK, error)

UpdateAliasAuthWithReturn issues an authenticated alias-update and returns the raw response/error so the caller can assert on rejection paths (e.g. malformed namespace prefix).

func UpdateAliasWithAuthz ¶ added in v1.32.0

func UpdateAliasWithAuthz(t *testing.T, aliasName, targetClassName string, authInfo runtime.ClientAuthInfoWriter)

func UpdateAliasWithReturn ¶ added in v1.32.0

func UpdateAliasWithReturn(t *testing.T, aliasName, targetClassName string) (*schema.AliasesUpdateOK, error)

func UpdateClass ¶

func UpdateClass(t *testing.T, class *models.Class)

func UpdateClassAuth ¶ added in v1.38.0

func UpdateClassAuth(t *testing.T, className string, class *models.Class, key string)

UpdateClassAuth issues an authenticated class-update and asserts ok. className is the path argument and may differ from class.Class — the caller controls what goes in the URL vs. the body.

func UpdateClassAuthWithReturn ¶ added in v1.38.0

func UpdateClassAuthWithReturn(t *testing.T, className string, class *models.Class, key string) (*schema.SchemaObjectsUpdateOK, error)

UpdateClassAuthWithReturn issues an authenticated class-update and returns the raw response/error. See UpdateClassAuth for the className vs. class.Class distinction.

func UpdateNamespace ¶ added in v1.38.0

func UpdateNamespace(t *testing.T, name, homeNode, key string) *models.Namespace

UpdateNamespace updates the namespace's home_node to the supplied value. Returns the server's view of the namespace after the update.

func UpdateObject ¶

func UpdateObject(t *testing.T, object *models.Object) error

func UpdateObjectCL ¶ added in v1.18.0

func UpdateObjectCL(t *testing.T, object *models.Object, cl types.ConsistencyLevel) error

func UpdateObjectWithResponse ¶ added in v1.32.0

func UpdateObjectWithResponse(t *testing.T, object *models.Object) (*models.Object, error)

func UpdateReferenceTenant ¶ added in v1.20.0

func UpdateReferenceTenant(t *testing.T, object *models.Object, ref models.MultipleRef, prop string, tenant string)

func UpdateTenants ¶ added in v1.26.0

func UpdateTenants(t *testing.T, class string, tenants []*models.Tenant)

func UpdateTenantsReturnError ¶ added in v1.26.0

func UpdateTenantsReturnError(t *testing.T, class string, tenants []*models.Tenant) error

func UpdateTenantsWithAuthz ¶ added in v1.28.3

func UpdateTenantsWithAuthz(t *testing.T, class string, tenants []*models.Tenant, authInfo runtime.ClientAuthInfoWriter)

func ValidateObject ¶ added in v1.32.0

func ValidateObject(t *testing.T, object *models.Object) error

func WaitForNamespaceGone ¶ added in v1.38.0

func WaitForNamespaceGone(t *testing.T, name, key string, timeout time.Duration)

WaitForNamespaceGone polls Get on the named namespace until it returns 404 or the timeout elapses.

func WaitForOwnRole ¶ added in v1.38.0

func WaitForOwnRole(t *testing.T, apikey, roleName string)

WaitForOwnRole waits for the role binding to be visible both on the leader (GetOwnInfo, Raft-routed) and on the local follower (self GetUserInfo, runs Authorize locally). The follower probe pins the RAFT-apply lag that would otherwise 403 the next authz-checked request. It needs read_users so it only runs for built-in admin/viewer; custom roles get only the leader-side guarantee.

Types ¶

type AliasesPermission ¶ added in v1.32.0

type AliasesPermission models.Permission

func NewAliasesPermission ¶ added in v1.32.0

func NewAliasesPermission() *AliasesPermission

func (*AliasesPermission) Permission ¶ added in v1.32.0

func (p *AliasesPermission) Permission() *models.Permission

func (*AliasesPermission) WithAction ¶ added in v1.32.0

func (p *AliasesPermission) WithAction(action string) *AliasesPermission

func (*AliasesPermission) WithAlias ¶ added in v1.32.0

func (p *AliasesPermission) WithAlias(alias string) *AliasesPermission

func (*AliasesPermission) WithCollection ¶ added in v1.32.0

func (p *AliasesPermission) WithCollection(collection string) *AliasesPermission

type BackupExpectOpt ¶ added in v1.33.0

type BackupExpectOpt func(*backupExpectOpt)

func WithDeadline ¶ added in v1.33.0

func WithDeadline(d time.Duration) BackupExpectOpt

Set the deadline for receiving status SUCCESS. Waiting indefinitely is not allowed, use MaxDeadline instead.

func WithPollInterval ¶ added in v1.33.0

func WithPollInterval(d time.Duration) BackupExpectOpt

Set the interval for polling backup create/restore status. Pass MinPollInterval for rapid checks.

type BackupPermission ¶ added in v1.28.0

type BackupPermission models.Permission

func NewBackupPermission ¶ added in v1.28.0

func NewBackupPermission() *BackupPermission

func (*BackupPermission) Permission ¶ added in v1.28.0

func (p *BackupPermission) Permission() *models.Permission

func (*BackupPermission) WithAction ¶ added in v1.28.0

func (p *BackupPermission) WithAction(action string) *BackupPermission

func (*BackupPermission) WithCollection ¶ added in v1.28.0

func (p *BackupPermission) WithCollection(collection string) *BackupPermission

type CollectionsPermission ¶ added in v1.28.0

type CollectionsPermission models.Permission

func NewCollectionsPermission ¶ added in v1.28.0

func NewCollectionsPermission() *CollectionsPermission

func (*CollectionsPermission) Permission ¶ added in v1.28.0

func (p *CollectionsPermission) Permission() *models.Permission

func (*CollectionsPermission) WithAction ¶ added in v1.28.0

func (p *CollectionsPermission) WithAction(action string) *CollectionsPermission

func (*CollectionsPermission) WithCollection ¶ added in v1.28.0

func (p *CollectionsPermission) WithCollection(collection string) *CollectionsPermission

type DataPermission ¶ added in v1.28.0

type DataPermission models.Permission

func NewDataPermission ¶ added in v1.28.0

func NewDataPermission() *DataPermission

func (*DataPermission) Permission ¶ added in v1.28.0

func (p *DataPermission) Permission() *models.Permission

func (*DataPermission) WithAction ¶ added in v1.28.0

func (p *DataPermission) WithAction(action string) *DataPermission

func (*DataPermission) WithCollection ¶ added in v1.28.0

func (p *DataPermission) WithCollection(collection string) *DataPermission

func (*DataPermission) WithObject ¶ added in v1.28.0

func (p *DataPermission) WithObject(object string) *DataPermission

func (*DataPermission) WithTenant ¶ added in v1.28.0

func (p *DataPermission) WithTenant(tenant string) *DataPermission

type DeleteNamespaceOption ¶ added in v1.38.0

type DeleteNamespaceOption func(*deleteNamespaceOptions)

DeleteNamespaceOption configures DeleteNamespace.

func WithoutWaitForCleanup ¶ added in v1.38.0

func WithoutWaitForCleanup() DeleteNamespaceOption

WithoutWaitForCleanup makes DeleteNamespace return as soon as the 202 is received instead of polling Get until 404. Use it when the test wants to observe the deleting state itself.

type NamespacesPermission ¶ added in v1.38.0

type NamespacesPermission models.Permission

NamespacesPermission is a builder for namespace-scoped permissions. Mirrors the other builders in rbac.go (e.g. NewAliasesPermission).

func NewNamespacesPermission ¶ added in v1.38.0

func NewNamespacesPermission() *NamespacesPermission

func (*NamespacesPermission) Permission ¶ added in v1.38.0

func (p *NamespacesPermission) Permission() *models.Permission

func (*NamespacesPermission) WithAction ¶ added in v1.38.0

func (p *NamespacesPermission) WithAction(action string) *NamespacesPermission

func (*NamespacesPermission) WithNamespace ¶ added in v1.38.0

func (p *NamespacesPermission) WithNamespace(namespace string) *NamespacesPermission

type NodesPermission ¶ added in v1.28.0

type NodesPermission models.Permission

func NewNodesPermission ¶ added in v1.28.0

func NewNodesPermission() *NodesPermission

func (*NodesPermission) Permission ¶ added in v1.28.0

func (p *NodesPermission) Permission() *models.Permission

func (*NodesPermission) WithAction ¶ added in v1.28.0

func (p *NodesPermission) WithAction(action string) *NodesPermission

func (*NodesPermission) WithCollection ¶ added in v1.28.0

func (p *NodesPermission) WithCollection(collection string) *NodesPermission

func (*NodesPermission) WithVerbosity ¶ added in v1.28.0

func (p *NodesPermission) WithVerbosity(verbosity string) *NodesPermission

type TenantsPermission ¶ added in v1.28.3

type TenantsPermission models.Permission

func NewTenantsPermission ¶ added in v1.28.3

func NewTenantsPermission() *TenantsPermission

func (*TenantsPermission) Permission ¶ added in v1.28.3

func (p *TenantsPermission) Permission() *models.Permission

func (*TenantsPermission) WithAction ¶ added in v1.28.3

func (p *TenantsPermission) WithAction(action string) *TenantsPermission

func (*TenantsPermission) WithCollection ¶ added in v1.28.3

func (p *TenantsPermission) WithCollection(collection string) *TenantsPermission

func (*TenantsPermission) WithTenant ¶ added in v1.28.3

func (p *TenantsPermission) WithTenant(tenant string) *TenantsPermission

Directories ¶

Path Synopsis
Package backuptest provides self-contained test infrastructure for backup integration tests.
Package backuptest provides self-contained test infrastructure for backup integration tests.
sample-schema

Jump to

Keyboard shortcuts

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