mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* Consolidating route type utilization Fixes: #197 * Adding --version to fn init CLI command * Updating functions_go to 0.1.36 * Updating route init process * Updating tests * Adding "memory" CLI flag to fn run * Make CLI memory flag override what's in func.yaml * Get rid of default value for memory flag * Revert UX impact func.yaml remains the same, no nested maps
46 lines
703 B
Go
46 lines
703 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"os"
|
|
"os/exec"
|
|
"path"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestMainCommands(t *testing.T) {
|
|
testCommands := []string{
|
|
"init",
|
|
"apps",
|
|
"routes",
|
|
"images",
|
|
"lambda",
|
|
"version",
|
|
"build",
|
|
"bump",
|
|
"deploy",
|
|
"run",
|
|
"push",
|
|
"logs",
|
|
"calls",
|
|
"call",
|
|
}
|
|
|
|
fnTestBin := path.Join(os.TempDir(), "fn-test")
|
|
|
|
err := exec.Command("go", "build", "-o", fnTestBin).Run()
|
|
if err != nil {
|
|
t.Fatalf("Failed to build fn: err: %s", err)
|
|
}
|
|
|
|
for _, cmd := range testCommands {
|
|
res, err := exec.Command(fnTestBin, strings.Split(cmd, " ")...).CombinedOutput()
|
|
if bytes.Contains(res, []byte("command not found")) {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
os.Remove(fnTestBin)
|
|
}
|