| 49 | } |
| 50 | |
| 51 | func TestSync_ExistingPath(t *testing.T) { |
| 52 | tmpDir := t.TempDir() |
| 53 | existingFile := filepath.Join(tmpDir, "exists.txt") |
| 54 | assert.NilError(t, os.WriteFile(existingFile, []byte("data"), 0o644)) |
| 55 | |
| 56 | client := &fakeLowLevelClient{ |
| 57 | containers: []container.Summary{{ID: "ctr1"}}, |
| 58 | } |
| 59 | tar := NewTar("proj", client) |
| 60 | |
| 61 | err := tar.Sync(t.Context(), "svc", []*PathMapping{ |
| 62 | {HostPath: existingFile, ContainerPath: "/app/exists.txt"}, |
| 63 | }) |
| 64 | |
| 65 | assert.NilError(t, err) |
| 66 | assert.Equal(t, client.untarCount, 1, "existing path should be copied via Untar") |
| 67 | assert.Equal(t, len(client.execCmds), 0, "no delete command expected for existing path") |
| 68 | } |
| 69 | |
| 70 | func TestSync_NonExistentPath(t *testing.T) { |
| 71 | client := &fakeLowLevelClient{ |