@@ -11,6 +11,7 @@ import (
1111 "os"
1212 "os/exec"
1313 "path/filepath"
14+ "regexp"
1415 "strings"
1516 "sync"
1617 "time"
@@ -37,6 +38,7 @@ type TestResult struct {
3738func main () {
3839 ctx := context .Background ()
3940 skipSetup := os .Getenv ("SKIP_SETUP" ) == "true"
41+ onlySetup := os .Getenv ("ONLY_SETUP" ) == "true"
4042 //
4143 // Install KEDA HTTP Add-on
4244 //
@@ -50,27 +52,29 @@ func main() {
5052 }
5153 }
5254
53- //
54- // Execute tests
55- //
56- testResults := executeTestCases (ctx )
57-
58- //
59- // Uninstall KEDA
60- //
61- if ! skipSetup {
62- passed := uninstallKeda (ctx )
63- if ! passed {
64- os .Exit (1 )
55+ if ! onlySetup {
56+ //
57+ // Execute tests
58+ //
59+ testResults := executeTestCases (ctx )
60+
61+ //
62+ // Uninstall KEDA
63+ //
64+ if ! skipSetup {
65+ passed := uninstallKeda (ctx )
66+ if ! passed {
67+ os .Exit (1 )
68+ }
6569 }
66- }
6770
68- //
69- // Generate execution outcome
70- //
71- exitCode := evaluateExecution (testResults )
71+ //
72+ // Generate execution outcome
73+ //
74+ exitCode := evaluateExecution (testResults )
7275
73- os .Exit (exitCode )
76+ os .Exit (exitCode )
77+ }
7478}
7579
7680func executeTest (ctx context.Context , file string , timeout string , tries int ) TestResult {
@@ -102,14 +106,25 @@ func executeTest(ctx context.Context, file string, timeout string, tries int) Te
102106func getTestFiles () []string {
103107 testFiles := []string {}
104108
105- err := filepath .Walk ("tests" ,
109+ e2eRegex := os .Getenv ("E2E_TEST_REGEX" )
110+ if e2eRegex == "" {
111+ e2eRegex = ".*"
112+ }
113+ regex , err := regexp .Compile (e2eRegex )
114+ if err != nil {
115+ fmt .Printf ("Error compiling regex: %s\n " , err )
116+ os .Exit (1 )
117+ }
118+
119+ err = filepath .Walk ("tests" ,
106120 func (path string , info os.FileInfo , err error ) error {
107121 if err != nil {
108122 return err
109123 }
110124
111125 if strings .Contains (path , "checks" ) &&
112- strings .HasSuffix (info .Name (), "_test.go" ) {
126+ strings .HasSuffix (info .Name (), "_test.go" ) &&
127+ regex .MatchString (info .Name ()) {
113128 testFiles = append (testFiles , path )
114129 }
115130 return nil
0 commit comments