Skip to content

Commit e899efd

Browse files
committed
refactor: simplify test setup and improve SSH compatibility
- Remove unused import of strconv - Remove environment variables PUID and PGID from the test container setup - Enable UseInsecureCipher in SSH options for compatibility Signed-off-by: appleboy <[email protected]>
1 parent 3fd8cd5 commit e899efd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

plugin_test.go

+7-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"io"
88
"os"
99
"reflect"
10-
"strconv"
1110
"strings"
1211
"testing"
1312
"time"
@@ -978,8 +977,6 @@ func TestSSHWithTestcontainers(t *testing.T) {
978977
Image: "linuxserver/openssh-server:latest",
979978
ExposedPorts: []string{"2222/tcp"}, // Default port for this image is 2222
980979
Env: map[string]string{
981-
"PUID": strconv.Itoa(os.Getuid()), // Use current user's UID
982-
"PGID": strconv.Itoa(os.Getgid()), // Use current user's GID
983980
"USER_NAME": "testuser",
984981
"USER_PASSWORD": "testpass",
985982
"PASSWORD_ACCESS": "true", // Enable password authentication
@@ -1021,12 +1018,13 @@ func TestSSHWithTestcontainers(t *testing.T) {
10211018

10221019
plugin := Plugin{
10231020
Config: Config{
1024-
Host: []string{host},
1025-
Username: "testuser", // Use the configured username
1026-
Port: port.Int(), // Use the mapped port
1027-
Password: "testpass", // Use the configured password
1028-
Script: []string{"whoami"},
1029-
CommandTimeout: 60 * time.Second,
1021+
Host: []string{host},
1022+
Username: "testuser", // Use the configured username
1023+
Port: port.Int(), // Use the mapped port
1024+
Password: "testpass", // Use the configured password
1025+
Script: []string{"whoami"},
1026+
CommandTimeout: 60 * time.Second,
1027+
UseInsecureCipher: true, // Allow insecure ciphers for compatibility
10301028
},
10311029
Writer: &buffer,
10321030
}

0 commit comments

Comments
 (0)