This is an automated email from the ASF dual-hosted git repository.
jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 354ee3c705e Add TypeScript SDK coordinator schema-mapping tests
(#69297)
354ee3c705e is described below
commit 354ee3c705e2b0181723cacc02f7bd88a94d39a7
Author: Guan-Ming Chiu <[email protected]>
AuthorDate: Thu Jul 9 12:37:09 2026 +0800
Add TypeScript SDK coordinator schema-mapping tests (#69297)
---
ts-sdk/tests/coordinator/client.test.ts | 40 ++++++++++++++++++++++++++++
ts-sdk/tests/coordinator/integration.test.ts | 2 ++
2 files changed, 42 insertions(+)
diff --git a/ts-sdk/tests/coordinator/client.test.ts
b/ts-sdk/tests/coordinator/client.test.ts
index 0511ffd4179..b2583e80e0a 100644
--- a/ts-sdk/tests/coordinator/client.test.ts
+++ b/ts-sdk/tests/coordinator/client.test.ts
@@ -125,6 +125,29 @@ describe("client is bound to TaskContext", () => {
});
});
+ it("defaults getXCom locator fields from ctx with snake_case wire names",
async () => {
+ const sent: Record<string, unknown>[] = [];
+ const recordingComm = {
+ request: async (b: Record<string, unknown>) => {
+ sent.push(b);
+ return { body: { type: "XComResult", key: b.key, value: null } };
+ },
+ } as unknown as CommChannel;
+ const c = createCoordinatorClient(recordingComm, FAKE_CTX);
+
+ await c.getXCom({ key: "k" });
+
+ expect(sent[0]).toEqual({
+ type: "GetXCom",
+ key: "k",
+ dag_id: "d",
+ task_id: "t",
+ run_id: "r",
+ map_index: null,
+ include_prior_dates: false,
+ });
+ });
+
it("maps camelCase public XCom options to snake_case supervisor fields",
async () => {
const sent: Record<string, unknown>[] = [];
const recordingComm = {
@@ -197,6 +220,23 @@ describe("getConnection", () => {
});
});
+ it("coerces absent optional wire fields to null public fields", async () => {
+ const c = client([
+ { body: { type: "ConnectionResult", conn_id: "bare", conn_type:
"generic" } },
+ ]);
+
+ await expect(c.getConnection("bare")).resolves.toEqual({
+ id: "bare",
+ type: "generic",
+ host: null,
+ schema: null,
+ login: null,
+ password: null,
+ port: null,
+ extra: null,
+ });
+ });
+
it("returns null for missing connections", async () => {
const c = client([{ body: { type: "ErrorResponse", error:
"CONNECTION_NOT_FOUND" } }]);
expect(await c.getConnection("missing")).toBeNull();
diff --git a/ts-sdk/tests/coordinator/integration.test.ts
b/ts-sdk/tests/coordinator/integration.test.ts
index 42dc3650a4e..a580159073e 100644
--- a/ts-sdk/tests/coordinator/integration.test.ts
+++ b/ts-sdk/tests/coordinator/integration.test.ts
@@ -248,6 +248,8 @@ describe("coordinator runtime integration", () => {
taskId: "say_hello",
dagId: "test_dag",
runId: "r1",
+ tryNumber: 1,
+ mapIndex: -1,
});
expect(result.logRecords.some((r) => r["event"] === "[ts-sdk.runtime] Task
succeeded")).toBe(
true,