fn icon indicating copy to clipboard operation
fn copied to clipboard

Fn test --remote wraps test input into extra object

Open evilguc opened this issue 7 years ago • 0 comments

Description

fn test --remote seems to have a slightly incorrect behavior. It wraps input in additional { "Body": ... } object.

Steps to reproduce the issue:

$ fn init --runtime=node js

$ cd js/

$ cat <<EOF > func.js
var fdk=require('@fnproject/fdk');

fdk.handle(function(input){
  return input;
})
EOF

$ cat <<EOF > test.json
{
    "tests": [
        {
            "input": {
                "body": {
                    "first_name": "Johnny",
                    "last_name": "Smith"
                }
            },
            "output": {
                "body": {
                    "first_name": "Johnny",
                    "last_name": "Smith"
                }
            }
        }
    ]
}
EOF

$ cat <<EOF > func.yaml
name: js
version: 0.0.1
runtime: node
entrypoint: node func.js
format: json
path: /js
EOF

Describe the results you received:

screenshot_2018-07-06_22-00-33

screenshot_2018-07-06_22-19-12

screenshot_2018-07-06_22-26-49

screenshot_2018-07-06_22-24-25

  1. fn test --remote resulted in PASSED status
  2. fn test --remote wrapped input into a extra object so function received unexpected input and test is actually failed

Describe the results you expected:

fn test --remote should not be different from fn test in handling tests.json

Additional information you deem important (e.g. issue happens only occasionally):

Same behavior for other runtimes (at least with node and python).

Output of fn version (CLI command):

fn version 0.4.117

evilguc avatar Jul 06 '18 19:07 evilguc