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
18 changes: 18 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,21 @@ jobs:
useBuildpacks: false
validateMapping: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloud_event --signature-type cloudevent'"

- name: Run HTTP conformance tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.1.0
with:
version: 'v1.1.0'
functionType: 'http'
useBuildpacks: false
validateMapping: false
cmd: "'functions-framework --source tests/conformance/main.py --target write_http_declarative'"

- name: Run cloudevent conformance tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@v1.1.0
with:
version: 'v1.1.0'
functionType: 'cloudevent'
useBuildpacks: false
validateMapping: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloudevent_declarative'"
13 changes: 13 additions & 0 deletions tests/conformance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from cloudevents.http import to_json

import functions_framework

filename = "function_output.json"


Expand Down Expand Up @@ -33,3 +35,14 @@ def write_legacy_event(data, context):

def write_cloud_event(cloudevent):
_write_output(to_json(cloudevent).decode())


@functions_framework.http
def write_http_declarative(request):
_write_output(json.dumps(request.json))
return "OK", 200


@functions_framework.cloudevent
def write_cloudevent_declarative(cloudevent):
_write_output(to_json(cloudevent).decode())