MCPcopy Create free account
hub / github.com/rilldata/rill / RequireOLAPTableCount

Function RequireOLAPTableCount

runtime/testruntime/olap.go:32–52  ·  view source on GitHub ↗
(t testing.TB, rt *runtime.Runtime, id, name string, count int)

Source from the content-addressed store, hash-verified

30}
31
32func RequireOLAPTableCount(t testing.TB, rt *runtime.Runtime, id, name string, count int) {
33 ctx := t.Context()
34 olap, release, err := rt.OLAP(ctx, id, "")
35 require.NoError(t, err)
36 defer release()
37
38 _, err = olap.InformationSchema().Lookup(ctx, "", "", name)
39 require.NoError(t, err)
40
41 rows, err := olap.Query(ctx, &drivers.Statement{Query: fmt.Sprintf(`SELECT count(*) FROM %s`, olap.Dialect().EscapeIdentifier(name))})
42 require.NoError(t, err)
43 defer rows.Close()
44
45 var n int
46 for rows.Next() {
47 err := rows.Scan(&n)
48 require.NoError(t, err)
49 }
50 require.NoError(t, rows.Err())
51 require.Equal(t, count, n)
52}
53
54func RequireIsView(t testing.TB, olap drivers.OLAPStore, tableName string, isView bool) {
55 table, err := olap.InformationSchema().Lookup(t.Context(), "", "", tableName)

Callers 7

TestCompleteFunction · 0.92
TestSourceFunction · 0.92
TestCacheInvalidationFunction · 0.92
TestRenameToOtherFunction · 0.92
TestInterdependenceFunction · 0.92

Calls 11

OLAPMethod · 0.80
ContextMethod · 0.65
LookupMethod · 0.65
InformationSchemaMethod · 0.65
QueryMethod · 0.65
EscapeIdentifierMethod · 0.65
DialectMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
ScanMethod · 0.65
ErrMethod · 0.65

Tested by 7

TestCompleteFunction · 0.74
TestSourceFunction · 0.74
TestCacheInvalidationFunction · 0.74
TestRenameToOtherFunction · 0.74
TestInterdependenceFunction · 0.74