Documentation ¶
Index ¶
- func ContainsNFileActions[T any](t *testing.T, fileOp *pb.Op_File, n int, msg string) ([]*pb.FileAction, []T)
- func ContainsNOps[T any](t *testing.T, ops []pb.Op, n int, msg string) ([]pb.Op, []T)
- func HasValidInputs(t *testing.T, opMap map[digest.Digest]pb.Op, op pb.Op) []pb.Op
- func LastOp(t *testing.T, arr []pb.Op) (digest.Digest, int)
- func ParseDef(t *testing.T, def [][]byte) (map[digest.Digest]pb.Op, []pb.Op)
- type Assertions
- func (llbt *Assertions) ContainsNCopyActions(fileOp *pb.Op_File, n int) ([]*pb.FileAction, []*pb.FileAction_Copy)
- func (llbt *Assertions) ContainsNExecOps(n int) ([]pb.Op, []*pb.Op_Exec)
- func (llbt *Assertions) ContainsNFileOps(n int) ([]pb.Op, []*pb.Op_File)
- func (llbt *Assertions) ContainsNSourceOps(n int) ([]pb.Op, []*pb.Op_Source)
- func (llbt *Assertions) HasCustomName(name string, op pb.Op)
- func (llbt *Assertions) HasDescription(key string, op pb.Op) string
- func (llbt *Assertions) HasOpMetadata(op pb.Op) pb.OpMetadata
- func (llbt *Assertions) HasValidInputs(op pb.Op) []pb.Op
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsNFileActions ¶
func ContainsNFileActions[T any](t *testing.T, fileOp *pb.Op_File, n int, msg string) ([]*pb.FileAction, []T)
ContainsNFileActions requires that there are exactly n pb.FileAction within the pb.Op_File that are of the given type. If successful, the matching pb.FileAction and encapsulated pb.FileAction.Action field of the given type are returned.
func ContainsNOps ¶
ContainsNOps requires that there are exactly n pb.Op that are of the given type. If successful, the matching pb.Op and encapsulated pb.Op.Op field of the given type are returned.
func HasValidInputs ¶
HasValidInputs takes a pb.Op and asserts that all of its pb.Op.Inputs have a corresponding pb.Op in the given op map. If the assertion succeeds, each corresponding pb.Op is returned.
Types ¶
type Assertions ¶
type Assertions struct { *require.Assertions // contains filtered or unexported fields }
Assertions provides methods for making assertions on LLB build graphs, specifically the marshaled llb.Definition and pb.Op therein. It extends require.Assertions to provide a singular assertions interface in LLB related tests.
func New ¶
func New(t *testing.T, def *llb.Definition) *Assertions
New returns a new Assertions that encapsulates the testing.T and llb.Definition for ease of making many assertions about the contained op.
func (*Assertions) ContainsNCopyActions ¶
func (llbt *Assertions) ContainsNCopyActions(fileOp *pb.Op_File, n int) ([]*pb.FileAction, []*pb.FileAction_Copy)
ContainsNCopyActions is a convenience method for ContainsNFileActions[pb.FileAction_Copy](...)
func (*Assertions) ContainsNExecOps ¶
ContainsNExecOps is a convenience method for ContainsNOps[pb.Op_Exec](...)
func (*Assertions) ContainsNFileOps ¶
ContainsNFileOps is a convenience method for ContainsNOps[pb.Op_File](...)
func (*Assertions) ContainsNSourceOps ¶
ContainsNSourceOps is a convenience method for ContainsNOps[pb.Op_Source](...)
func (*Assertions) HasCustomName ¶ added in v1.0.0
func (llbt *Assertions) HasCustomName(name string, op pb.Op)
HasCustomName asserts that the given pb.Op has an "llb.customname" description in its pb.OpMetadata matching the given string.
func (*Assertions) HasDescription ¶ added in v1.0.0
func (llbt *Assertions) HasDescription(key string, op pb.Op) string
HasDescription asserts that the given pb.Op has the given description key in its pb.OpMetadata. If the assertion succeeds, the description value is returned.
func (*Assertions) HasOpMetadata ¶ added in v1.0.0
func (llbt *Assertions) HasOpMetadata(op pb.Op) pb.OpMetadata
HasOpMetadata asserts that the given pb.Op has pb.OpMetadata in the given llb.Definition. If the assertion succeeds, the pb.OpMetadata is returned.
func (*Assertions) HasValidInputs ¶
func (llbt *Assertions) HasValidInputs(op pb.Op) []pb.Op
HasValidInputs is a convenience method for HasValidInputs