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

Function workflow_sql_tests

test/console/mzcompose.py:65–121  ·  view source on GitHub ↗

Run console SQL tests against a running Materialize instance. Starts Materialized and supporting services, then runs yarn test:sql inside a Node.js container on the composition network so it can reach materialized and other services by hostname.

(c: Composition)

Source from the content-addressed store, hash-verified

63
64
65def workflow_sql_tests(c: Composition) -> None:
66 """
67 Run console SQL tests against a running Materialize instance.
68
69 Starts Materialized and supporting services, then runs yarn test:sql
70 inside a Node.js container on the composition network so it can reach
71 materialized and other services by hostname.
72 """
73 c.up(
74 "redpanda",
75 "postgres",
76 "sql-server",
77 "mysql",
78 "materialized",
79 Service("testdrive", idle=True),
80 Service("console-runner", idle=True),
81 )
82
83 # These commands require root (default user in node:22-alpine).
84 c.exec("console-runner", "apk", "add", "--no-cache", "docker-cli")
85 c.exec(
86 "console-runner",
87 "sh",
88 "-c",
89 "corepack enable",
90 env_extra={"COREPACK_ENABLE_DOWNLOAD_PROMPT": "0"},
91 )
92 # On macOS Docker Desktop the socket is owned by root with no group access,
93 # so the non-root host user cannot reach it.
94 c.exec("console-runner", "chmod", "o+rw", "/var/run/docker.sock")
95
96 # Run yarn as the host user so it doesn't create root-owned files
97 # in the bind-mounted node_modules directory.
98 _env = {
99 "MZ_INTERNAL_SQL_HOST": "materialized",
100 "MZ_INTERNAL_SQL_PORT": "6877",
101 "MZ_INTERNAL_HTTP_HOST": "materialized",
102 "MZ_INTERNAL_HTTP_PORT": "6878",
103 "COREPACK_ENABLE_DOWNLOAD_PROMPT": "0",
104 "HOME": "/tmp",
105 }
106 c.invoke(
107 "exec",
108 "--user",
109 _HOST_UID_GID,
110 *(f"-e{k}={v}" for k, v in _env.items()),
111 "-T",
112 "console-runner",
113 "sh",
114 "-c",
115 " && ".join(
116 [
117 "yarn install --immutable --network-timeout 30000",
118 "yarn test:sql --run",
119 ]
120 ),
121 )
122

Callers

nothing calls this directly

Calls 6

ServiceClass · 0.90
execMethod · 0.80
upMethod · 0.45
invokeMethod · 0.45
itemsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected