Skip to content

Commit

Permalink
test: adding oncluster builds e2e tests for s2i supported runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrangelramos committed Sep 13, 2022
1 parent 1ed5b2d commit 17d3e96
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions test/_oncluster/scenario_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package oncluster

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand All @@ -13,6 +14,15 @@ import (
e2e "knative.dev/kn-plugin-func/test/_e2e"
)

var runtimeSupportMap = map[string][]string{
"node": {"pack", "s2i"},
"go": {},
"python": {"pack"},
"quarkus": {"pack", "s2i"},
"springboot": {"pack"},
"typescript": {"pack", "s2i"},
}

// TestRuntime will invoke a language runtime test against (by default) to all runtimes.
// The Environment Variable E2E_RUNTIMES can be used to select the languages/runtimes to be tested
func TestRuntime(t *testing.T) {
Expand All @@ -25,19 +35,24 @@ func TestRuntime(t *testing.T) {
runtimeList = strings.Split(runtimes, " ")
}
} else {
runtimeList = []string{"node", "python", "quarkus", "springboot", "typescript"} // "go" and "rust" pending support
for k := range runtimeSupportMap {
runtimeList = append(runtimeList, k)
}
}

for _, lang := range runtimeList {
t.Run(lang+"_test", func(t *testing.T) {
runtimeImpl(t, lang)
})
for _, builder := range runtimeSupportMap[lang] {
t.Run(fmt.Sprintf("%v_%v_test", lang, builder), func(t *testing.T) {
runtimeImpl(t, lang, builder)
})
}
}

}

func runtimeImpl(t *testing.T, lang string) {
func runtimeImpl(t *testing.T, lang string, builder string) {

var gitProjectName = "test-func-lang-" + lang
var gitProjectName = fmt.Sprintf("test-runtime-%v-%v", lang, builder)
var gitProjectPath = filepath.Join(os.TempDir(), gitProjectName)
var funcName = gitProjectName
var funcPath = gitProjectPath
Expand All @@ -56,6 +71,7 @@ func runtimeImpl(t *testing.T, lang string) {
knFunc.Exec("deploy",
"-r", e2e.GetRegistry(),
"-p", funcPath,
"--builder", builder,
"--build", "git",
"--git-url", remoteRepo.ClusterCloneURL)

Expand Down

0 comments on commit 17d3e96

Please sign in to comment.