end2end

package
v0.62.7 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 15 Imported by: 0

README

dalgo/end2end

End-to-end conformance tests for DALgo database adapters.

Adapters should import github.com/dal-go/dalgo/end2end and call end2end.TestDalgoDB from their own integration tests.

Query capability reporting

TestDalgoDB(t, db, errQuerySupport, eventuallyConsistent) gates the whole query suite on errQuerySupport: pass a non-nil error and every query test is skipped (for adapters with no query support at all).

Beyond that coarse gate, individual query features are capability-reported per query. The suite exercises advanced shapes — column projection, GROUP BY aggregation with HAVING, and both the records and recordset read paths — and an adapter that does not implement a given shape is expected to return an error that wraps dal.ErrNotSupported. The shared tests detect this via errors.Is(err, dal.ErrNotSupported) and t.Skip that sub-test rather than failing. So returning dal.ErrNotSupported (not a silent wrong result) is the contract for an unsupported query feature; adapters opt into coverage simply by implementing the feature.

Both read paths are covered for the same query:

  • records readertx.ExecuteQueryToRecordsReader / dal.ExecuteQueryAndReadAllToRecords.
  • recordset readertx.ExecuteQueryToRecordsetReader / dal.ExecuteQueryAndReadAllToRecordset (the columnar path used by tabular consumers such as DataTug).

Documentation

Index

Constants

View Source
const (
	TestEntitiesNamePrefix = "DalgoE2E_"

	// E2ETestKind1 defines table or collection name for an entity to be stored in
	E2ETestKind1 = TestEntitiesNamePrefix + "E2ETest1"
	// E2ETestKind2 defines table or collection name for an entity to be stored in
	E2ETestKind2 = TestEntitiesNamePrefix + "E2ETest2"
)

Variables

This section is empty.

Functions

func TestDalgoDB

func TestDalgoDB(t *testing.T, db dal.DB, errQuerySupport error, eventuallyConsistent bool)

TestDalgoDB tests a dalgo DB implementation

Types

type TestData

type TestData struct {
	StringProp  string `json:"StringProp,omitempty" db:"StringProp"`
	IntegerProp int    `json:"IntegerProp" db:"IntegerProp"`
}

TestData describes a test entity to be stored in a DALgo database

func (TestData) Validate

func (v TestData) Validate() error

Validate returns error if not valid

type User

type User struct {
	Title string `json:"title,omitempty"`
	Email string `json:"email,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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