MCPcopy Create free account
hub / github.com/AdRoll/baker / testSQLiteInsertRows

Function testSQLiteInsertRows

output/sqlite_test.go:160–183  ·  view source on GitHub ↗
(t *testing.T, raw bool)

Source from the content-addressed store, hash-verified

158func TestSQLiteRawInsertRows(t *testing.T) { testSQLiteInsertRows(t, true) }
159
160func testSQLiteInsertRows(t *testing.T, raw bool) {
161 // This test tests that the lines fed into the output actually
162 // show up in the output file. raw indicates whether the SQLWriter
163 // is a raw one, in which case we also want to test that raw log lines
164 // have been inserted, in addition to the set of fields.
165 fn, rm := testutil.TempFile(t)
166 defer rm()
167
168 doOneRound(t, fn, raw)
169
170 var want [][]string
171 want = append(want, []string{"val12345", "1500000", "BLAH"})
172 want = append(want, []string{"val12345", "1500001", "BLAH"})
173 want = append(want, []string{"val12348", "1500005", "BLOH"})
174 want = append(want, []string{"val12349", "1500007", "BLUH"})
175
176 if raw {
177 for i := range want {
178 want[i] = append(want[i], fmt.Sprintf("rawrecord%d", i))
179 }
180 }
181
182 assertRows(t, fn, want)
183}
184
185func TestSQLiteNoTruncate(t *testing.T) {
186 // Tests that running the output twice doesn't truncate the table

Callers 2

TestSQLiteInsertRowsFunction · 0.85
TestSQLiteRawInsertRowsFunction · 0.85

Calls 3

TempFileFunction · 0.92
doOneRoundFunction · 0.85
assertRowsFunction · 0.85

Tested by

no test coverage detected