Documentation ¶
Index ¶
- Variables
- func ClickhouseCluster(t TestingT) (string, string)
- func DeleteFiles(t testing.TB, rt *runtime.Runtime, id string, files ...string)
- func DumpResources(t testing.TB, rt *runtime.Runtime, id string)
- func GetResource(t testing.TB, rt *runtime.Runtime, id, kind, name string) *runtimev1.Resource
- func Must[T any](v T, err error) T
- func New(t TestingT) *runtime.Runtime
- func NewInstance(t TestingT) (*runtime.Runtime, string)
- func NewInstanceForDruidProject(t *testing.T) (*runtime.Runtime, string, error)
- func NewInstanceForProject(t TestingT, name string) (*runtime.Runtime, string)
- func NewInstanceWithClickhouseProject(t TestingT, withCluster bool) (*runtime.Runtime, string)
- func NewInstanceWithModel(t TestingT, name, sql string) (*runtime.Runtime, string)
- func NewInstanceWithOptions(t TestingT, opts InstanceOptions) (*runtime.Runtime, string)
- func PutFiles(t testing.TB, rt *runtime.Runtime, id string, files map[string]string)
- func ReconcileAndWait(t testing.TB, rt *runtime.Runtime, id string, n *runtimev1.ResourceName)
- func ReconcileParserAndWait(t testing.TB, rt *runtime.Runtime, id string)
- func RefreshAndWait(t testing.TB, rt *runtime.Runtime, id string, n *runtimev1.ResourceName)
- func RenameFile(t testing.TB, rt *runtime.Runtime, id, from, to string)
- func RequireIsView(t testing.TB, olap drivers.OLAPStore, tableName string, isView bool)
- func RequireNoOLAPTable(t testing.TB, rt *runtime.Runtime, id, name string)
- func RequireOLAPTable(t testing.TB, rt *runtime.Runtime, id, name string)
- func RequireOLAPTableCount(t testing.TB, rt *runtime.Runtime, id, name string, count int)
- func RequireParseErrors(t testing.TB, rt *runtime.Runtime, id string, ...)
- func RequireReconcileState(t testing.TB, rt *runtime.Runtime, id string, ...)
- func RequireResource(t testing.TB, rt *runtime.Runtime, id string, a *runtimev1.Resource)
- type ConnectorAcquireFunc
- type InstanceOptions
- type TestingT
Constants ¶
This section is empty.
Variables ¶
var Connectors = map[string]ConnectorAcquireFunc{ "clickhouse": func(t TestingT) map[string]string { _, currentFile, _, _ := goruntime.Caller(0) testdataPath := filepath.Join(currentFile, "..", "testdata") ctx := context.Background() clickHouseContainer, err := clickhouse.Run( ctx, "clickhouse/clickhouse-server:24.6.2.17", clickhouse.WithUsername("clickhouse"), clickhouse.WithPassword("clickhouse"), clickhouse.WithConfigFile(filepath.Join(testdataPath, "clickhouse-config.xml")), testcontainers.CustomizeRequestOption(func(req *testcontainers.GenericContainerRequest) error { cf := testcontainers.ContainerFile{ HostFilePath: filepath.Join(testdataPath, "users.xml"), ContainerFilePath: "/etc/clickhouse-server/users.xml", FileMode: 0o755, } req.Files = append(req.Files, cf) return nil }), ) require.NoError(t, err) t.Cleanup(func() { err := clickHouseContainer.Terminate(ctx) require.NoError(t, err) }) host, err := clickHouseContainer.Host(ctx) require.NoError(t, err) port, err := clickHouseContainer.MappedPort(ctx, "9000/tcp") require.NoError(t, err) dsn := fmt.Sprintf("clickhouse://clickhouse:clickhouse@%v:%v", host, port.Port()) return map[string]string{"connector.clickhouse.dsn": dsn} }, "druid": func(t TestingT) map[string]string { _, currentFile, _, _ := goruntime.Caller(0) envPath := filepath.Join(currentFile, "..", "..", "..", ".env") _, err := os.Stat(envPath) if err == nil { require.NoError(t, godotenv.Load(envPath)) } dsn := os.Getenv("RILL_RUNTIME_DRUID_TEST_DSN") require.NotEmpty(t, dsn, "Druid test DSN not configured") return map[string]string{"connector.druid.dsn": dsn} }, }
Connectors is a map of available connectors for use in tests. When acquiring a connector, it will only be cleaned up when the test has completed. You should avoid acquiring the same connector multiple times in the same test.
Test connectors can either be implemented as: - Services embedded in the current process - Services started as ephemeral testcontainers - Real external services configured for use in tests with credentials provided in the root .env file with the prefix RILL_RUNTIME_TEST_.
Functions ¶
func ClickhouseCluster ¶ added in v0.49.0
func DeleteFiles ¶ added in v0.35.0
func DumpResources ¶ added in v0.35.0
func GetResource ¶ added in v0.50.0
func NewInstance ¶
NewInstance is a convenience wrapper around NewInstanceWithOptions, using defaults sensible for most tests.
func NewInstanceForDruidProject ¶ added in v0.46.0
func NewInstanceForProject ¶
NewInstanceForProject creates a runtime and an instance for use in tests. The passed name should match a test project in the testdata folder. You should not do mutable repo operations on the returned instance.
func NewInstanceWithClickhouseProject ¶ added in v0.49.0
func NewInstanceWithModel ¶
NewInstanceWithModel creates a runtime and an instance for use in tests. The passed model name and SQL SELECT statement will be loaded into the instance.
func NewInstanceWithOptions ¶ added in v0.35.0
func NewInstanceWithOptions(t TestingT, opts InstanceOptions) (*runtime.Runtime, string)
NewInstanceWithOptions creates a runtime and an instance for use in tests. The instance's repo is a temp directory that will be cleared when the tests finish.
func ReconcileAndWait ¶ added in v0.35.0
func ReconcileParserAndWait ¶ added in v0.35.0
func RefreshAndWait ¶ added in v0.35.0
func RenameFile ¶ added in v0.36.0
func RequireIsView ¶ added in v0.36.0
func RequireNoOLAPTable ¶ added in v0.35.0
func RequireOLAPTable ¶ added in v0.35.0
func RequireOLAPTableCount ¶ added in v0.35.0
func RequireParseErrors ¶ added in v0.36.0
func RequireReconcileState ¶ added in v0.35.0
Types ¶
type ConnectorAcquireFunc ¶ added in v0.51.0
ConnectorAcquireFunc is a function that acquires a connector for a test. It should return a map of variables to add to the test runtime instance.