mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
e2e framework: UniqueName
This is needed for tests which have to create entities that aren't namespaced, like ServiceAccounts.
This commit is contained in:
parent
022c05c141
commit
1effe0ca0f
@ -25,6 +25,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -68,6 +69,11 @@ const (
|
|||||||
type Framework struct {
|
type Framework struct {
|
||||||
BaseName string
|
BaseName string
|
||||||
|
|
||||||
|
// Set together with creating the ClientSet and the namespace.
|
||||||
|
// Guaranteed to be unique in the cluster even when running the same
|
||||||
|
// test multiple times in parallel.
|
||||||
|
UniqueName string
|
||||||
|
|
||||||
ClientSet clientset.Interface
|
ClientSet clientset.Interface
|
||||||
KubemarkExternalClusterClientSet clientset.Interface
|
KubemarkExternalClusterClientSet clientset.Interface
|
||||||
APIExtensionsClientSet apiextensionsclient.Interface
|
APIExtensionsClientSet apiextensionsclient.Interface
|
||||||
@ -229,6 +235,10 @@ func (f *Framework) BeforeEach() {
|
|||||||
} else {
|
} else {
|
||||||
Logf("Skipping waiting for service account")
|
Logf("Skipping waiting for service account")
|
||||||
}
|
}
|
||||||
|
f.UniqueName = f.Namespace.GetName()
|
||||||
|
} else {
|
||||||
|
// not guaranteed to be unique, but very likely
|
||||||
|
f.UniqueName = fmt.Sprintf("%s-%08x", f.BaseName, rand.Int31())
|
||||||
}
|
}
|
||||||
|
|
||||||
if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" {
|
if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" {
|
||||||
|
Loading…
Reference in New Issue
Block a user