| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project contains tooling for conformance and validation of Function Frameworks to the Functions Framework contract.
In your Functions Framework repo:
Each function write its inputs to the file function_output.json.
Build the test client:
cd functions-framework-conformance/client && \
go buildThis will create a client binary in functions-framework-conformance/client directory. You can use this binary to test the conformance of Function Frameworks.
Invoke the client binary with the following command to run your function server and the type of the function.
Go HTTP function Example:
$HOME/functions-framework-conformance/client/client \
-cmd="go run ." \
-type=http \
-builder-source=testdata \
-buildpacks=false.NET CloudEvent function example:
$HOME/functions-framework-conformance/client/client \
-cmd="dotnet run MyFunction" \
-type=cloudevent \
-buildpacks=falseNode.js legacy event function example:
$HOME/functions-framework-conformance/client/client \
-cmd="npx @google-cloud/functions-framework --target MyFunction --signature-type=event" \
-type=legacyevent \
-buildpacks=falseRuby typed http function Example:
$HOME/functions-framework-conformance/client/client \
-cmd="bundle exec functions-framework-ruby --source test/conformance/app.rb --target typed_func --signature-type http" \
--type=http \
--declarative-type=typed \
-buildpacks=falseIf there are validation errors, an error will be logged in the output, causing your conformance test to fail.
| Configuration flag | Type | Default | Description |
|---|---|---|---|
| -cmd | string | "''" | A string with the command to run a Functions Framework server at localhost:8080. Must be wrapped in quotes. Ignored if -buildpacks=true. |
| -type | string | "http" | The function signature to use (must be "http", "cloudevent", or "legacyevent"). |
| -declarative-type | string | "" | The declarative signature type of the function (must be 'http', 'cloudevent', 'legacyevent', or 'typed'), default matches -type |
| -validate-mapping | boolean | true | Whether to validate mapping from legacy->cloud events and vice versa (as applicable). |
| -output-file | string | "function_output.json" | Name of file output by function. |
| -buildpacks | boolean | true | Whether to use the current release of buildpacks to run the validation. If true, -cmd is ignored and --builder-* flags must be set. |
| -builder-source | string | "" | Function source directory to use in building. Required if -buildpacks=true. |
| -builder-target | string | "" | Function target to use in building. Required if -buildpacks=true. |
| -builder-runtime | string | "" | Runtime to use in building. Required if -buildpacks=true. |
| -builder-runtime-version | string | "" | Runtime version used while building. Buildpack will use the latest version if flag is not specified. |
| -builder-tag | string | "latest" | Builder image tag to use in building. Ignored if -builder-url is specified. |
| -builder-url | string | "" | Builder image url to use in building including tag. Client defaults to gcr.io/gae-runtimes/buildpacks/<language>/builder:<builder-tag> if none is specified. |
| -start-delay | uint | 1 | Seconds to wait before sending HTTP request to command process. |
| -envs | string | "" | A comma separated string of additional runtime environment variables. |
If -buildpacks is true, you must specify the following flags:
| Back | FazBrowse Home | New Git URL |