github.com/devcamcar/cli@v0.0.0-20181107134215-706a05759d18/test/cli_lang_boilerplate_test.go (about)

     1  package test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/fnproject/cli/testharness"
     8  )
     9  
    10  var Runtimes = []struct {
    11  	runtime   string
    12  	callInput string
    13  }{
    14  	{"go", ""},
    15  	{"java", ""},
    16  	{"java8", ""},
    17  	{"java9", ""},
    18  	{"kotlin", `{"name": "John"}`}, //  no arg fn run is broken https://github.com/fnproject/cli/issues/262
    19  	{"node", ""},
    20  	{"ruby", ""},
    21  	{"python", `{"name": "John"}`},
    22  }
    23  
    24  func TestFnInitWithBoilerplateBuildsRuns(t *testing.T) {
    25  	t.Parallel()
    26  
    27  	for _, runtimeI := range Runtimes {
    28  		rt := runtimeI
    29  		t.Run(fmt.Sprintf("%s runtime", rt.runtime), func(t *testing.T) {
    30  			t.Parallel()
    31  			h := testharness.Create(t)
    32  			defer h.Cleanup()
    33  
    34  			appName := h.NewAppName()
    35  			funcName := h.NewFuncName(appName)
    36  
    37  			h.Fn("init", "--runtime", rt.runtime, funcName).AssertSuccess()
    38  
    39  			h.Cd(funcName)
    40  			h.Fn("build").AssertSuccess()
    41  
    42  			h.Fn("--registry", "test", "deploy", "--local", "--app", appName).AssertSuccess()
    43  
    44  			h.FnWithInput(rt.callInput, "invoke", appName, funcName).AssertSuccess()
    45  		})
    46  	}
    47  
    48  }