Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,12 @@ jobs:
useBuildpacks: false
validateConcurrency: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_http_declarative_concurrent'"

- name: Run Typed tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
with:
version: 'v1.6.0'
functionType: 'http'
useBuildpacks: false
validateMapping: false
cmd: "'functions-framework --source tests/conformance/main.py --target write_typed_event_declarative'"
17 changes: 17 additions & 0 deletions tests/conformance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
filename = "function_output.json"


class ConformanceType:
json_request: str

def __init__(self, json_request: str) -> None:
self.json_request = json_request

@staticmethod
def from_dict(obj: dict) -> "ConformanceType":
return ConformanceType(json.dumps(obj))


def _write_output(content):
with open(filename, "w") as f:
f.write(content)
Expand Down Expand Up @@ -53,3 +64,9 @@ def write_cloud_event_declarative(cloud_event):
def write_http_declarative_concurrent(request):
time.sleep(1)
return "OK", 200


@functions_framework.typed(ConformanceType)
def write_typed_event_declarative(x):
_write_output(x.json_request)
return "OK"