From e899efd3c6402cbd61ddff53658ee4aa0867134b Mon Sep 17 00:00:00 2001 From: appleboy Date: Sat, 26 Apr 2025 23:17:37 +0800 Subject: [PATCH] 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 --- plugin_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugin_test.go b/plugin_test.go index e0c4f3f..ab783b8 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -7,7 +7,6 @@ import ( "io" "os" "reflect" - "strconv" "strings" "testing" "time" @@ -978,8 +977,6 @@ func TestSSHWithTestcontainers(t *testing.T) { Image: "linuxserver/openssh-server:latest", ExposedPorts: []string{"2222/tcp"}, // Default port for this image is 2222 Env: map[string]string{ - "PUID": strconv.Itoa(os.Getuid()), // Use current user's UID - "PGID": strconv.Itoa(os.Getgid()), // Use current user's GID "USER_NAME": "testuser", "USER_PASSWORD": "testpass", "PASSWORD_ACCESS": "true", // Enable password authentication @@ -1021,12 +1018,13 @@ func TestSSHWithTestcontainers(t *testing.T) { plugin := Plugin{ Config: Config{ - Host: []string{host}, - Username: "testuser", // Use the configured username - Port: port.Int(), // Use the mapped port - Password: "testpass", // Use the configured password - Script: []string{"whoami"}, - CommandTimeout: 60 * time.Second, + Host: []string{host}, + Username: "testuser", // Use the configured username + Port: port.Int(), // Use the mapped port + Password: "testpass", // Use the configured password + Script: []string{"whoami"}, + CommandTimeout: 60 * time.Second, + UseInsecureCipher: true, // Allow insecure ciphers for compatibility }, Writer: &buffer, }