mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #49037 from krousey/upgrades
Automatic merge from submit-queue Sanitize test names before using them as namespaces **What this PR does / why we need it**: It sanitizes upgrade test names before creating namespaces. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #48876
This commit is contained in:
commit
e09a353942
@ -21,6 +21,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -122,10 +124,7 @@ var _ = framework.KubeDescribe("Downgrade [Feature:Downgrade]", func() {
|
||||
|
||||
// Create the frameworks here because we can only create them
|
||||
// in a "Describe".
|
||||
testFrameworks := map[string]*framework.Framework{}
|
||||
for _, t := range upgradeTests {
|
||||
testFrameworks[t.Name()] = framework.NewDefaultFramework(t.Name())
|
||||
}
|
||||
testFrameworks := createUpgradeFrameworks()
|
||||
|
||||
framework.KubeDescribe("cluster downgrade", func() {
|
||||
It("should maintain a functioning cluster [Feature:ClusterDowngrade]", func() {
|
||||
@ -236,9 +235,12 @@ func finalizeUpgradeTest(start time.Time, tc *junit.TestCase) {
|
||||
}
|
||||
|
||||
func createUpgradeFrameworks() map[string]*framework.Framework {
|
||||
nsFilter := regexp.MustCompile("[^[:word:]-]+") // match anything that's not a word character or hyphen
|
||||
testFrameworks := map[string]*framework.Framework{}
|
||||
for _, t := range upgradeTests {
|
||||
testFrameworks[t.Name()] = framework.NewDefaultFramework(t.Name())
|
||||
ns := nsFilter.ReplaceAllString(t.Name(), "-") // and replace with a single hyphen
|
||||
ns = strings.Trim(ns, "-")
|
||||
testFrameworks[t.Name()] = framework.NewDefaultFramework(ns)
|
||||
}
|
||||
return testFrameworks
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user