MCPcopy
hub / github.com/docker/compose / TestSync_ExistingPath

Function TestSync_ExistingPath

internal/sync/tar_test.go:51–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func 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
70func TestSync_NonExistentPath(t *testing.T) {
71 client := &fakeLowLevelClient{

Callers

nothing calls this directly

Calls 4

SyncMethod · 0.95
NewTarFunction · 0.85
TempDirMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected