From e41808a0afa3acc6b38529508e3f58fb2bc6b492 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Fri, 14 Feb 2025 16:14:15 -0700 Subject: [PATCH 1/3] give QueryMethod type parameterS --- .../arbitraries/canister_methods/query_method_arb.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/property/arbitraries/canister_methods/query_method_arb.ts b/test/property/arbitraries/canister_methods/query_method_arb.ts index 562dd16324..9f322e10c4 100644 --- a/test/property/arbitraries/canister_methods/query_method_arb.ts +++ b/test/property/arbitraries/canister_methods/query_method_arb.ts @@ -16,7 +16,10 @@ import { TestsGenerator } from '.'; -export type QueryMethod = { +export type QueryMethod< + _ParamAgentArgumentValue extends CorrespondingJSType, + _ParamAgentResponseValue +> = { imports: Set; globalDeclarations: string[]; sourceCode: string; @@ -53,7 +56,7 @@ export function QueryMethodArb< ReturnTypeAgentResponseValue > > -): fc.Arbitrary { +): fc.Arbitrary> { const api = context.api; const constraints = context.constraints; return fc @@ -74,7 +77,10 @@ export function QueryMethodArb< returnType, defaultMethodImplementationLocation, methodName - ]): QueryMethod => { + ]): QueryMethod< + ParamAgentArgumentValue, + ParamAgentResponseValue + > => { const methodImplementationLocation = api === 'class' ? 'INLINE' From 839f261d80b834e8981cde532ef2d6f47b73cdf3 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Fri, 14 Feb 2025 16:27:29 -0700 Subject: [PATCH 2/3] move ovs to unstable, fix http outcall fetch tests and even test rejectCode and rejectMessage --- .github/actions/get_exclude_dirs/action.yml | 2 +- .../http_server/http_outcall_fetch/test/tests.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/actions/get_exclude_dirs/action.yml b/.github/actions/get_exclude_dirs/action.yml index d3f16bc8e7..52ecba8826 100644 --- a/.github/actions/get_exclude_dirs/action.yml +++ b/.github/actions/get_exclude_dirs/action.yml @@ -33,6 +33,7 @@ runs: examples/experimental/test/end_to_end/http_server/http_outcall_fetch examples/experimental/test/end_to_end/http_server/ic_evm_rpc examples/experimental/test/end_to_end/http_server/multi_deploy + examples/experimental/test/end_to_end/http_server/open_value_sharing examples/experimental/test/end_to_end/http_server/sqlite_drizzle examples/experimental/test/property/candid_rpc/opt examples/experimental/test/property/candid_rpc/stable_b_tree_map @@ -52,7 +53,6 @@ runs: examples/experimental/test/end_to_end/candid_rpc/stable_structures examples/experimental/test/end_to_end/http_server/autoreload examples/experimental/test/end_to_end/http_server/large_files - examples/experimental/test/end_to_end/http_server/open_value_sharing ') }}" EXCLUDE_DIRS="" diff --git a/examples/experimental/test/end_to_end/http_server/http_outcall_fetch/test/tests.ts b/examples/experimental/test/end_to_end/http_server/http_outcall_fetch/test/tests.ts index fd2b4f8a74..be9a1de2a3 100644 --- a/examples/experimental/test/end_to_end/http_server/http_outcall_fetch/test/tests.ts +++ b/examples/experimental/test/end_to_end/http_server/http_outcall_fetch/test/tests.ts @@ -208,7 +208,10 @@ export function getTests(canisterId: string): Test { expect(responseJson).toEqual({ message: - 'Rejection code 1, Header size exceeds specified response size limit 0' + 'The inter-canister call failed with reject code 1: Header size exceeds specified response size limit 0', + rejectCode: 1, + rejectMessage: + 'Header size exceeds specified response size limit 0' }); }); @@ -219,7 +222,7 @@ export function getTests(canisterId: string): Test { const responseJson = await response.json(); expect(responseJson.message).toMatch( - /Rejection code 4, http_request request sent with 0 cycles, but \d{1,3}(_\d{3})* cycles are required\./ + /reject code 4: http_request request sent with 0 cycles, but \d{1,3}(_\d{3})* cycles are required\./ ); }); }; From 7759db8261a5137cfab8c18546a3feddc3ae7d21 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Fri, 14 Feb 2025 16:30:44 -0700 Subject: [PATCH 3/3] fix type errors on QueryMethod --- test/property/arbitraries/canister_arb.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/property/arbitraries/canister_arb.ts b/test/property/arbitraries/canister_arb.ts index 55da3b7b1f..c3cde79440 100644 --- a/test/property/arbitraries/canister_arb.ts +++ b/test/property/arbitraries/canister_arb.ts @@ -22,7 +22,7 @@ export type CanisterMethod< ParamAgentArgumentValue extends CorrespondingJSType, ParamAgentResponseValue > = - | QueryMethod + | QueryMethod | UpdateMethod | InitMethod | PostUpgradeMethod @@ -41,7 +41,10 @@ export type CanisterConfig< ParamAgentResponseValue >; preUpgradeMethod?: PreUpgradeMethod; - queryMethods?: QueryMethod[]; + queryMethods?: QueryMethod< + ParamAgentArgumentValue, + ParamAgentResponseValue + >[]; updateMethods?: UpdateMethod< ParamAgentArgumentValue, ParamAgentResponseValue @@ -139,7 +142,7 @@ function generateSourceCode< globalDeclarations: string[], canisterMethods: ( | UpdateMethod - | QueryMethod + | QueryMethod )[], api: Api, inspectMessageImportHack?: boolean