MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / workflow_create

Function workflow_create

test/canary-environment/mzcompose.py:255–506  ·  view source on GitHub ↗
(c: Composition, parser: WorkflowArgumentParser)

Source from the content-addressed store, hash-verified

253
254
255def workflow_create(c: Composition, parser: WorkflowArgumentParser) -> None:
256 parser.add_argument(
257 "--wait-timeout",
258 default="1800",
259 help="Seconds to watch staging hydration before promoting anyway. "
260 "Hydration continues in production after promote, so this is just a "
261 "best-effort visibility window; 0 skips waiting.",
262 )
263 args = parser.parse_args()
264
265 assert MATERIALIZE_PROD_SANDBOX_USERNAME is not None
266 assert MATERIALIZE_PROD_SANDBOX_APP_PASSWORD is not None
267 assert MATERIALIZE_PROD_SANDBOX_HOSTNAME is not None
268 assert QA_CANARY_ICEBERG_GCP_SA_JSON_B64 is not None
269 assert QA_CANARY_ICEBERG_GCS_BUCKET is not None
270
271 # The secret resolver only resolves a top-level `env_var(...)`, so it can't
272 # base64-decode like the old `decode(<b64>, 'base64')` did. `CREATE SECRET`
273 # stores its value as bytea, and a raw-JSON literal fails `bytea_in` on the
274 # `\n` escapes in the private key. Hand the resolver the JSON *bytes* in
275 # bytea hex form (`\x...`), which reproduces exactly what the base64 decode
276 # produced.
277 os.environ["QA_CANARY_ICEBERG_GCP_SA_JSON"] = (
278 "\\x" + base64.b64decode(QA_CANARY_ICEBERG_GCP_SA_JSON_B64).hex()
279 )
280
281 write_profiles()
282 write_project_toml()
283
284 # mz-deploy is invoked one-shot via `c.run` (see mz_deploy), so only
285 # testdrive needs to be brought up.
286 c.up(Service("testdrive", idle=True))
287
288 materialize_url = f"postgres://{quote(MATERIALIZE_PROD_SANDBOX_USERNAME)}:{quote(MATERIALIZE_PROD_SANDBOX_APP_PASSWORD)}@{quote(MATERIALIZE_PROD_SANDBOX_HOSTNAME)}:6875"
289
290 # ── 1. Upstream RDS/MySQL setup (outside Materialize) ─────────────────
291 # Create the replicated tables, publication, and the cron/event jobs that
292 # keep them churning. mz-deploy can't manage these — they live on RDS.
293 with c.override(
294 Testdrive(
295 default_timeout="1200s",
296 materialize_url=materialize_url,
297 no_reset=True, # Required so that admin port 6877 is not used
298 no_consistency_checks=True, # No access to HTTP for coordinator check
299 )
300 ):
301 c.testdrive(input=dedent(f"""
302 > SELECT 1
303 1
304
305 $ mysql-connect name=mysql url=mysql://admin@{MATERIALIZE_PROD_SANDBOX_RDS_MYSQL_HOSTNAME} password={MATERIALIZE_PROD_SANDBOX_RDS_MYSQL_PASSWORD}
306 $ mysql-execute name=mysql
307 DROP DATABASE IF EXISTS public;
308 CREATE DATABASE public;
309 USE public;
310
311 CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY, name TEXT, incarnation INTEGER DEFAULT 1);
312 CREATE TABLE IF NOT EXISTS relationships (a INTEGER, b INTEGER, incarnation INTEGER DEFAULT 1, PRIMARY KEY (a,b));

Callers

nothing calls this directly

Calls 10

ServiceClass · 0.90
TestdriveClass · 0.90
bootstrap_namespaceFunction · 0.90
write_profilesFunction · 0.85
mz_deployFunction · 0.85
deploy_idFunction · 0.85
overrideMethod · 0.80
write_project_tomlFunction · 0.70
upMethod · 0.45
testdriveMethod · 0.45

Tested by

no test coverage detected