aqltest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package aqltest holds the AQL fixtures every search backend must agree on (decision 0012): seed items chosen to trip the dialect traps (a GLOB character class, LIKE wildcards in names, a multi-byte character, a missing time, a remote cache, an item without statistics beside one whose statistics are zero), the repositories they live in, the query shapes the JFrog CLI generates, and the rows each query returns, in order.

BuildSeeds add build runs and promotions that relate to the items by checksum, for the relation-path cases and the builds and build.promotions cases (BuildCases).

The pkg/aql tests run the cases through aql.SelectItems and aql.SelectBuilds over Corpus; the store contract suite runs them through every ItemStore.Search and BuildStore.Search. Both resolve each query against Repositories first, as the server does.

Index

Constants

This section is empty.

Variables

View Source
var Base = time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)

Base is the seeds' clock: item n was created n minutes after it.

View Source
var Now = Base.Add(time.Hour)

Now is the clock the cases run at, for $before and $last.

Functions

func BuildRows

func BuildRows(hits []aql.BuildHit) []string

BuildRows renders builds hits as "<name>/<number>#<run ID>", and promotions hits with " <status>" after their run.

func Corpus

func Corpus() *aql.Corpus

Corpus returns Hits and the build seeds as stored, with IDs from 1, for running the cases through aql.SelectItems and aql.SelectBuilds.

func Hits

func Hits() []aql.Hit

Hits returns the seeds as stored: IDs from 1 and the depth the stores derive, for running the cases through aql.Select.

func Paths

func Paths(hits []aql.Hit) []string

Paths renders hits the way Case.Want lists them.

func Repositories

func Repositories() aql.Repositories

Repositories configures the seeds' repositories, and virtual ones over them: libs-virtual nests the remote, all-virtual nests libs-virtual and a member nothing configures, and loop-virtual names itself.

Types

type BuildSeed

type BuildSeed struct {
	Build      types.Build
	Promotions []types.BuildPromotion
}

BuildSeed is one build run to store after Seeds, with its promotions, whose BuildID the store's ID for the run replaces.

func BuildSeeds

func BuildSeeds() []BuildSeed

BuildSeeds returns the runs in insertion order, so stores give them IDs from 1 and their promotions IDs from 1 in the order listed. They relate to Seeds by checksum and are chosen to trip the join traps: the jar is an artifact of app/1 and app/2 and a dependency of tool/1, so a name and a number met by different runs must not match; naïve.txt is an artifact of app/2 and tool/1; app/1 is published twice; a dependency names a checksum no item has; and one module has no files.

type Case

type Case struct {
	Name  string
	Query string
	// Built is a query built in code, run instead of Query: the GET
	// searches' queries, which AQL text cannot always say.
	Built   *aql.Query
	Options aql.Options
	Want    []string
}

Case is a query and the rows it returns, as "<reported repo>/<path>".

func BuildCases

func BuildCases() []Case

BuildCases returns the builds and build.promotions queries over BuildSeeds, with the rows each returns as BuildRows renders them.

func Cases

func Cases() []Case

Cases returns the CLI fixtures followed by the cases for each operator and dialect trap.

func RelatedCases

func RelatedCases() []Case

RelatedCases are queries whose include names fields of related domains (#410), in both directions. The rows they nest come from an aql.Source, so every store's (store.AQLSource) must nest what Corpus does; the pkg/aql tests pin what that is.

func (Case) Parse

func (c Case) Parse() (*aql.Query, error)

Parse returns the case's query, Built or Query parsed, resolved against Repositories.

type Seed

type Seed struct {
	Item       types.Item
	Properties types.Properties
	Stats      *types.ItemStats
}

Seed is one item to store, with its properties and its statistics; nil Stats stores no statistics record.

func Seeds

func Seeds() []Seed

Seeds returns the items in insertion order; stores give them ascending IDs, which break ties in every ordering.

Jump to

Keyboard shortcuts

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