Skip to content

Commit 0d02cbb

Browse files
committed
refactor: migrate TestSudoCommand to key-based authentication
- Disable password authentication by setting PASSWORD_ACCESS to false in TestSudoCommand - Remove the use of direct password authentication in favor of key-based authentication in TestSudoCommand Signed-off-by: appleboy <[email protected]>
1 parent ff79cee commit 0d02cbb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

plugin_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ func TestSudoCommand(t *testing.T) {
930930
Env: map[string]string{
931931
"USER_NAME": "testuser",
932932
"USER_PASSWORD": "testpass",
933-
"PASSWORD_ACCESS": "true", // Enable password authentication
934-
"SUDO_ACCESS": "true", // Optional: grant sudo access
933+
"PASSWORD_ACCESS": "false", // Enable password authentication
934+
"SUDO_ACCESS": "true", // Optional: grant sudo access
935935
"PUBLIC_KEY": string(pubKey),
936936
},
937937
// Wait for the SSH port (2222) to be listening
@@ -976,7 +976,6 @@ func TestSudoCommand(t *testing.T) {
976976
Host: []string{host},
977977
Username: "testuser", // Use the configured username
978978
Port: port.Int(), // Use the mapped port
979-
Password: "testpass", // Use the configured password
980979
KeyPath: "./tests/.ssh/id_rsa",
981980
Script: []string{
982981
`sudo su - -c "whoami"`,

0 commit comments

Comments
 (0)