Skip to content

Commit

Permalink
refactor:custom names support (keploy#1602)
Browse files Browse the repository at this point in the history
Signed-off-by: shivamsouravjha <[email protected]>
  • Loading branch information
shivamsouravjha authored Feb 21, 2024
1 parent e117ea1 commit 2484073
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"path/filepath"
"strconv"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -233,20 +232,11 @@ func ReadSessionIndices(path string, Logger *zap.Logger) ([]string, error) {
}

for _, v := range files {
// Define the regular expression pattern
pattern := fmt.Sprintf(`^%s\d{1,}$`, models.TestSetPattern)

// Compile the regular expression
regex, err := regexp.Compile(pattern)
if err != nil {
return indices, err
}

// Check if the string matches the pattern
if regex.MatchString(v.Name()) {
if v.Name() != "testReports" {
indices = append(indices, v.Name())
}
}

return indices, nil
}

Expand All @@ -255,7 +245,7 @@ func DeleteTestReports(logger *zap.Logger, generateTestReport bool) {
if generateTestReport {
return
}

_, err := os.Stat("keploy/testReports")
if os.IsNotExist(err) {
return
Expand All @@ -267,4 +257,4 @@ func DeleteTestReports(logger *zap.Logger, generateTestReport bool) {
}

logger.Info("Test Reports are being removed since generateTestReport flag is set false")
}
}

0 comments on commit 2484073

Please sign in to comment.