mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #87021 from tanjunchen/remove-the-same-function-test
test/e2e/framework:remove generateWriteBlockCmd due to the repeat to …
This commit is contained in:
commit
38e5dc6974
@ -543,38 +543,13 @@ func GenerateScriptCmd(command string) []string {
|
|||||||
return commands
|
return commands
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateWriteBlockCmd generates the corresponding command lines to write to a block device the given content.
|
// generateWriteCmd is used by generateWriteBlockCmd and generateWriteFileCmd
|
||||||
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
func generateWriteCmd(content, path string) []string {
|
||||||
func generateWriteBlockCmd(content, fullPath string) []string {
|
|
||||||
var commands []string
|
var commands []string
|
||||||
if !framework.NodeOSDistroIs("windows") {
|
if !framework.NodeOSDistroIs("windows") {
|
||||||
commands = []string{"/bin/sh", "-c", "echo '" + content + "' > " + fullPath}
|
commands = []string{"/bin/sh", "-c", "echo '" + content + "' > " + path}
|
||||||
} else {
|
} else {
|
||||||
commands = []string{"powershell", "/c", "echo '" + content + "' > " + fullPath}
|
commands = []string{"powershell", "/c", "echo '" + content + "' > " + path}
|
||||||
}
|
|
||||||
return commands
|
|
||||||
}
|
|
||||||
|
|
||||||
// generateWriteFileCmd generates the corresponding command lines to write a file with the given content and file path.
|
|
||||||
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
|
||||||
func generateWriteFileCmd(content, fullPath string) []string {
|
|
||||||
var commands []string
|
|
||||||
if !framework.NodeOSDistroIs("windows") {
|
|
||||||
commands = []string{"/bin/sh", "-c", "echo '" + content + "' > " + fullPath}
|
|
||||||
} else {
|
|
||||||
commands = []string{"powershell", "/c", "echo '" + content + "' > " + fullPath}
|
|
||||||
}
|
|
||||||
return commands
|
|
||||||
}
|
|
||||||
|
|
||||||
// generateReadFileCmd generates the corresponding command lines to read from a file with the given file path.
|
|
||||||
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
|
||||||
func generateReadFileCmd(fullPath string) []string {
|
|
||||||
var commands []string
|
|
||||||
if !framework.NodeOSDistroIs("windows") {
|
|
||||||
commands = []string{"cat", fullPath}
|
|
||||||
} else {
|
|
||||||
commands = []string{"powershell", "/c", "type " + fullPath}
|
|
||||||
}
|
}
|
||||||
return commands
|
return commands
|
||||||
}
|
}
|
||||||
@ -592,6 +567,30 @@ func generateReadBlockCmd(fullPath string, numberOfCharacters int) []string {
|
|||||||
return commands
|
return commands
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generateWriteBlockCmd generates the corresponding command lines to write to a block device the given content.
|
||||||
|
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
||||||
|
func generateWriteBlockCmd(content, fullPath string) []string {
|
||||||
|
return generateWriteCmd(content, fullPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// generateReadFileCmd generates the corresponding command lines to read from a file with the given file path.
|
||||||
|
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
||||||
|
func generateReadFileCmd(fullPath string) []string {
|
||||||
|
var commands []string
|
||||||
|
if !framework.NodeOSDistroIs("windows") {
|
||||||
|
commands = []string{"cat", fullPath}
|
||||||
|
} else {
|
||||||
|
commands = []string{"powershell", "/c", "type " + fullPath}
|
||||||
|
}
|
||||||
|
return commands
|
||||||
|
}
|
||||||
|
|
||||||
|
// generateWriteFileCmd generates the corresponding command lines to write a file with the given content and file path.
|
||||||
|
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
|
||||||
|
func generateWriteFileCmd(content, fullPath string) []string {
|
||||||
|
return generateWriteCmd(content, fullPath)
|
||||||
|
}
|
||||||
|
|
||||||
// GenerateSecurityContext generates the corresponding container security context with the given inputs
|
// GenerateSecurityContext generates the corresponding container security context with the given inputs
|
||||||
// If the Node OS is windows, currently we will ignore the inputs and return nil.
|
// If the Node OS is windows, currently we will ignore the inputs and return nil.
|
||||||
// TODO: Will modify it after windows has its own security context
|
// TODO: Will modify it after windows has its own security context
|
||||||
|
Loading…
Reference in New Issue
Block a user