mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
gofmt rkt.go, rkt_test.go
This commit is contained in:
parent
89e1382dd9
commit
7de2d51f90
@ -1111,10 +1111,10 @@ func (r *Runtime) getSelinuxContext(opt *v1.SELinuxOptions) (string, error) {
|
|||||||
// From the generateName or the podName return a basename for improving the logging with the Journal
|
// From the generateName or the podName return a basename for improving the logging with the Journal
|
||||||
// journalctl -t podBaseName
|
// journalctl -t podBaseName
|
||||||
func constructSyslogIdentifier(generateName string, podName string) string {
|
func constructSyslogIdentifier(generateName string, podName string) string {
|
||||||
if (len(generateName) > 1 && generateName[len(generateName) - 1] == '-') {
|
if len(generateName) > 1 && generateName[len(generateName)-1] == '-' {
|
||||||
return generateName[0:len(generateName) - 1]
|
return generateName[0 : len(generateName)-1]
|
||||||
}
|
}
|
||||||
if (len(generateName) > 0) {
|
if len(generateName) > 0 {
|
||||||
return generateName
|
return generateName
|
||||||
}
|
}
|
||||||
return podName
|
return podName
|
||||||
|
@ -1955,9 +1955,9 @@ func TestPreparePodArgs(t *testing.T) {
|
|||||||
|
|
||||||
func TestConstructSyslogIdentifier(t *testing.T) {
|
func TestConstructSyslogIdentifier(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
podName string
|
podName string
|
||||||
podGenerateName string
|
podGenerateName string
|
||||||
identifier string
|
identifier string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"prometheus-node-exporter-rv90m",
|
"prometheus-node-exporter-rv90m",
|
||||||
@ -1979,4 +1979,4 @@ func TestConstructSyslogIdentifier(t *testing.T) {
|
|||||||
identifier := constructSyslogIdentifier(testCase.podGenerateName, testCase.podName)
|
identifier := constructSyslogIdentifier(testCase.podGenerateName, testCase.podName)
|
||||||
assert.Equal(t, testCase.identifier, identifier, fmt.Sprintf("Test case #%d", i))
|
assert.Equal(t, testCase.identifier, identifier, fmt.Sprintf("Test case #%d", i))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user