MCPcopy
hub / github.com/PeerDB-io/peerdb / Test_Toast_SF

Method Test_Toast_SF

flow/e2e/snowflake_test.go:234–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

232}
233
234func (s PeerFlowE2ETestSuiteSF) Test_Toast_SF() {
235 tc := NewTemporalClient(s.t)
236
237 srcTableName := s.attachSchemaSuffix("test_toast_sf_1")
238 dstTableName := fmt.Sprintf("%s.%s", s.sfHelper.testSchemaName, "test_toast_sf_1")
239
240 _, err := s.Conn().Exec(s.t.Context(), fmt.Sprintf(`
241 CREATE TABLE IF NOT EXISTS %s (
242 id SERIAL PRIMARY KEY,
243 t1 text,
244 t2 text,
245 k int
246 );
247 `, srcTableName))
248 require.NoError(s.t, err)
249
250 connectionGen := FlowConnectionGenerationConfig{
251 FlowJobName: s.attachSuffix("test_toast_sf_1"),
252 TableNameMapping: map[string]string{srcTableName: dstTableName},
253 Destination: s.Peer().Name,
254 }
255
256 flowConnConfig := connectionGen.GenerateFlowConnectionConfigs(s)
257 flowConnConfig.MaxBatchSize = 100
258
259 // wait for PeerFlowStatusQuery to finish setup
260 // and execute a transaction touching toast columns
261 env := ExecutePeerflow(s.t, tc, flowConnConfig)
262 SetupCDCFlowStatusQuery(s.t, env, flowConnConfig)
263 /*
264 Executing a transaction which
265 1. changes both toast column
266 2. changes no toast column
267 2. changes 1 toast column
268 */
269 _, err = s.Conn().Exec(s.t.Context(), fmt.Sprintf(`
270 BEGIN;
271 INSERT INTO %s (t1,t2,k) SELECT random_string(9000),random_string(9000),
272 1 FROM generate_series(1,2);
273 UPDATE %s SET k=102 WHERE id=1;
274 UPDATE %s SET t1='dummy' WHERE id=2;
275 END;
276 `, srcTableName, srcTableName, srcTableName))
277 EnvNoError(s.t, env, err)
278 s.t.Log("Executed a transaction touching toast columns")
279 EnvWaitForEqualTables(env, s, "normalizing tx", "test_toast_sf_1", `id,t1,t2,k`)
280 env.Cancel(s.t.Context())
281
282 RequireEnvCanceled(s.t, env)
283}
284
285func (s PeerFlowE2ETestSuiteSF) Test_Toast_Advance_1_SF() {
286 tc := NewTemporalClient(s.t)

Callers

nothing calls this directly

Calls 14

attachSchemaSuffixMethod · 0.95
ConnMethod · 0.95
attachSuffixMethod · 0.95
PeerMethod · 0.95
NewTemporalClientFunction · 0.85
ExecutePeerflowFunction · 0.85
SetupCDCFlowStatusQueryFunction · 0.85
EnvNoErrorFunction · 0.85
EnvWaitForEqualTablesFunction · 0.85
RequireEnvCanceledFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected