Open bluezd opened 6 years ago
Hi and welcome! Here's the thing. You actually allocated problematic area very explicitly, however, it not related to fdk-go. If you'd like to test your function, you need to use the following commands:
fn test
or
fn run
Because the format env var is not the only var you'd need to set (there are at least 6 to 10 env vars FDK would need).
So, the thing you've done is not typic or even recommended path go. I recommend you to spend some time playing with interactive tutorial here: https://www.katacoda.com/fnproject/scenarios/fn-intro
I did fn test
and fn run
and it behaves normally. I am just wondering how to test the function locally, as you said it is not recommended. I got it. Thanks.
Well. There have to be 2 ways to test your function:
fn test
with a bunch of test suitesSo, FDK-go misses the 2nd point. I'd better rename this issue to something in lines to:
Provide Go native testing framework for functions for sake of better coverage
Sure, agree.
Fixing this issue is simple:
However for users who are totally new to the fn project they usually have no idea about what is going wrong there . They just wanna make sure their function works properly locally before building a fn app.
Shall we develop a patch in go FDK side for telling user what is going wrong there and how to fix it rather that a panic without any prompt ?