Skip to content

Commit 61090c9

Browse files
committed
Review fixes
1 parent 41f8c3b commit 61090c9

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

shared/connection.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ func (c *Connection) Healthcheck() ([]byte, error) {
320320
}
321321

322322
if cmd == "host" {
323-
return nil, errors.New(L("healthcheck not supported on host"))
323+
// Healthcheck not supported on host, always return nil
324+
return nil, nil
324325
}
325326

326327
cmdArgs := []string{"healthcheck", "run", c.podName}
@@ -399,7 +400,7 @@ func (c *Connection) Copy(src string, dst string, user string, group string) err
399400
}
400401

401402
srcPath := strings.Replace(src, "server:", "", 1)
402-
// Assume the same name as the source if we use copy with just "server:""
403+
// Assume the same name as the source if we use copy with just "server:"
403404
// Similarly if we copy to the directory "something/"
404405
if strings.HasSuffix(dst, ":") || strings.HasSuffix(dst, "/") {
405406
dst += filepath.Base(srcPath)
@@ -448,7 +449,7 @@ func (c *Connection) Copy(src string, dst string, user string, group string) err
448449
if command == "kubectl" {
449450
execArgs = append(execArgs, "-n", namespace)
450451
}
451-
if command == "host" {
452+
if c.backend == "host" {
452453
execArgs = []string{owner, dstPath}
453454
command = "chown"
454455
} else {

shared/connection_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ func TestHostInferredCopy(t *testing.T) {
190190
t.Errorf("Expected command 'cp', got '%s'", capturedCommand)
191191
}
192192

193+
if len(capturedArgs) < 2 {
194+
t.Fatal("Unexpected number of captured args")
195+
}
196+
193197
if capturedArgs[0] != "/home/myfile" || capturedArgs[1] != "/tmp/myfile" {
194198
t.Errorf("Expected args ['/home/myfile', '/tmp/myfile'], got %v", capturedArgs)
195199
}
@@ -199,6 +203,10 @@ func TestHostInferredCopy(t *testing.T) {
199203
t.Errorf("Copy returned error: %v", err)
200204
}
201205

206+
if len(capturedArgs) < 2 {
207+
t.Fatal("Unexpected number of captured args")
208+
}
209+
202210
if capturedArgs[0] != "/tmp/myanotherfile" || capturedArgs[1] != "myanotherfile" {
203211
t.Errorf("Expected args ['/tmp/myanotherfile', 'myanotherfile'], got %v", capturedArgs)
204212
}

0 commit comments

Comments
 (0)