-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FDK testkit initial commit #1
Open
denismakogon
wants to merge
16
commits into
master
Choose a base branch
from
fdk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0e2df9e
Initia commit: FDK testkit
denismakogon 51d9953
Vendoring dependencies
denismakogon 392bb2d
Make builds and distribution simple
denismakogon e63d8c3
Fixing dockerfile
denismakogon 5c17a64
internal API improvements
denismakogon 52b7990
FDK concurrency test: run 100 concurrent calls against the function
denismakogon c67e474
Check for HTTP 501 on responses
denismakogon 7da20ca
Run echo test in multiple iteration with different inputs
denismakogon 04b3492
Run multiple events test as sequence of requests to let one function …
denismakogon 0e9b7b0
Make formats configurable
denismakogon 4375996
Making all HTTP request with context only
denismakogon b4efe7b
Log app, route and call ID
denismakogon c93cb76
Make test suite cleanup configurable
denismakogon 4d1a31c
Get rid of http 501 check
denismakogon 8d83af3
Get rid of vendored code
denismakogon eeeb6a3
Fix dockerfile
denismakogon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Go template | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 | ||
.glide/ | ||
.idea | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# build stage | ||
FROM golang:alpine AS build-env | ||
RUN apk --no-cache add build-base git bzr mercurial gcc | ||
RUN go get -u github.com/golang/dep/cmd/dep | ||
ENV D=/go/src/github.com/fnproject/fdk-testkit | ||
ADD . $D | ||
WORKDIR $D | ||
RUN $GOPATH/bin/dep ensure | ||
RUN go test -c -i && cp fdk-testkit.test /tmp/ | ||
|
||
# final stage | ||
FROM fnproject/dind | ||
WORKDIR /app | ||
COPY --from=build-env /tmp/fdk-testkit.test /app/fdk-testkit | ||
CMD ["./fdk-testkit"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/fnproject/fn_go" | ||
version = "0.2.1" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/go-openapi/runtime" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/go-openapi/strfmt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Just builds | ||
.PHONY: build test | ||
|
||
build: | ||
go test -c -i | ||
|
||
test: | ||
go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,92 @@ | ||
# fdk-testkit | ||
Compatibility validation tests suite for programming language-specific Fn development kits (FDK) | ||
Testing FDK-based functions | ||
=========================== | ||
|
||
Function development kit (FDK) as a piece of software that helps to write hot functions by encapsulating logic of processing incoming requests with respect to defined protocol (HTTP, JSON). | ||
Particular testing framework help developers to identify if any programming language-specific FDK compatible with Fn hot formats. | ||
|
||
|
||
Prerequisites | ||
------------- | ||
|
||
This testing framework allows to run FDK tests against live Fn service, to let tests know of where Fn service is hosted please set following environment variable: | ||
```bash | ||
export FN_API_URL=http://fn.io:8080 | ||
``` | ||
|
||
Test suite requires general purpose programming language-specific FDK-based function image that must be developed specifically for this test suite, following environment variable must be set: | ||
```bash | ||
export FDK_FUNCTION_IMAGE="..." | ||
``` | ||
This environment variable should contain a reference to the particular docker image. | ||
|
||
At this moment Fn server supports 3 formats: | ||
|
||
- default | ||
- http | ||
- json | ||
|
||
To let developers freedom of choice test suite allows to configure list of formats to test against FDK. | ||
By default tests will use two hot formats: `json` and `http`, it's possible to override those formats using following environment format: | ||
```bash | ||
export FDK_FORMATS=json,http | ||
``` | ||
Test suite details | ||
------------------ | ||
|
||
Test suite contains following tests: | ||
|
||
1. `TestFDKFormatSmallBody` | ||
|
||
`TestFDKFormatSmallBody` test | ||
-------------------------- | ||
|
||
FDK should support following formats: | ||
|
||
- HTTP (subtest: `test-fdk-http-small-body`) | ||
- JSON (subtest: `test-fdk-json-small-body`) | ||
|
||
Request input body: | ||
```json | ||
{ | ||
"name": "Jimmy" | ||
} | ||
``` | ||
|
||
Response output body: | ||
```text | ||
Hello Jimmy | ||
``` | ||
|
||
How to run tests? | ||
----------------- | ||
|
||
There are couple options: from source code, from release binary | ||
|
||
From source code: | ||
```bash | ||
go test -v ./... | ||
``` | ||
|
||
How to keep test apps and routes in place? | ||
------------------------------------------ | ||
|
||
By default testkit runs cleanup for all app and routes created during particular execution. | ||
In order to keep them in place to let developers work with results test suite can be configured with following boolean environment variable: | ||
```bash | ||
export DISABLE_TESTKIT_CLEANUP=true | ||
``` | ||
`True` options: "1", "t", "T", "true", "TRUE", "True" | ||
`False` options: "0", "f", "F", "false", "FALSE", "False" | ||
|
||
How to build test binary executable? | ||
------------------------------------ | ||
|
||
Regular `go build` does not work with tests, so following command will create a binary executable for this particular test suite: | ||
```bash | ||
go test -c -i | ||
``` | ||
|
||
Sample FDK-based functions | ||
-------------------------- | ||
|
||
As an example test suite supplied with general purpose test [function written with FDK Python](./functions/python). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my pull in fn core, should gopy only gopkg files, then do
dep ensure --vendor-only
, then do this add in a layer after that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed