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

Function doOneRoundTruncate

output/sqlite_test.go:74–106  ·  view source on GitHub ↗
(t *testing.T, path string, truncate, raw bool)

Source from the content-addressed store, hash-verified

72}
73
74func doOneRoundTruncate(t *testing.T, path string, truncate, raw bool) {
75 t.Helper()
76
77 writer := makeWriter(t, raw, path, truncate)
78
79 wg := &sync.WaitGroup{}
80 outch := make(chan baker.OutputRecord)
81 upch := make(chan string)
82
83 path_seen := false
84
85 wg.Add(1)
86 go func() {
87 outch <- baker.OutputRecord{Fields: []string{"val12345", "1500000", "BLAH"}, Record: []byte("rawrecord0")}
88 outch <- baker.OutputRecord{Fields: []string{"val12345", "1500001", "BLAH"}, Record: []byte("rawrecord1")}
89 outch <- baker.OutputRecord{Fields: []string{"val12348", "1500005", "BLOH"}, Record: []byte("rawrecord2")}
90 outch <- baker.OutputRecord{Fields: []string{"val12349", "1500007", "BLUH"}, Record: []byte("rawrecord3")}
91 close(outch)
92 for upchpath := range upch {
93 if upchpath == path {
94 path_seen = true
95 }
96 }
97 wg.Done()
98 }()
99 writer.Run(outch, upch)
100 close(upch)
101 wg.Wait()
102
103 if !path_seen {
104 t.Fatalf("SQLite file was not sent to upch.")
105 }
106}
107
108func assertRows(t *testing.T, fname string, want [][]string) {
109 // this helper asserts we're going to find these rows and records in

Callers 2

doOneRoundFunction · 0.85
TestSQLiteTruncateFunction · 0.85

Calls 4

makeWriterFunction · 0.85
DoneMethod · 0.80
RunMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected