vmware-archive / kubeless

Kubernetes Native Serverless Framework
https://kubeless.io
Apache License 2.0
6.86k stars 754 forks source link

Add test utility to support TDD #562

Open byteSamurai opened 6 years ago

byteSamurai commented 6 years ago

FEATURE REQUEST:

Looking at the makefile I saw some verification tasks. In my opinion tests should be an (optional) artifact of a deployed function. Is it possible to add an optional field to the function.yaml to define some value, to send it to a deployed function and what values we would expect to get?

Tests could be called by:

kubeless function test get-python

The field in function.yaml might look like:

[...]
tests: 
  input: 
    comparator: expectedResult

More concrete example of a function which prints the passed parameters.

[...]
tests: 
  echo: 
    is: echo
  echo2: 
    contains: echo2

In my opinion is and contain should be enough to keep it simple. Its just a quick idea, but combined with the vscode plugin it could be a really neat way to do TDD.

arapulido commented 6 years ago

Thanks for the suggestion! Right now this is not in scope for 1.0, but we welcome PRs! If you want to give it a try, let us know, and we can help you with the PR process