MCPcopy Create free account
hub / github.com/compose-spec/compose-go / TestDevelopWatch

Function TestDevelopWatch

loader/tests/develop_test.go:28–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestDevelopWatch(t *testing.T) {
29 p, err := loader.LoadWithContext(context.TODO(), types.ConfigDetails{
30 ConfigFiles: []types.ConfigFile{{Filename: "compose.yml", Content: []byte(`
31name: test
32services:
33 web:
34 image: app
35 build: ./app
36 develop:
37 watch:
38 - path: ./src
39 action: sync
40 target: /app/src
41 ignore:
42 - node_modules/
43 initial_sync: true
44 - path: ./requirements.txt
45 action: rebuild
46 - path: ./config.yml
47 action: sync+restart
48 target: /app/config.yml
49`)}},
50 Environment: map[string]string{},
51 }, func(options *loader.Options) {
52 options.ResolvePaths = false
53 options.SkipValidation = true
54 })
55 assert.NilError(t, err)
56 dev := p.Services["web"].Develop
57 assert.Assert(t, dev != nil)
58
59 assert.Equal(t, len(dev.Watch), 3)
60
61 assert.Equal(t, dev.Watch[0].Path, "./src")
62 assert.Equal(t, dev.Watch[0].Action, types.WatchActionSync)
63 assert.Equal(t, dev.Watch[0].Target, "/app/src")
64 assert.DeepEqual(t, dev.Watch[0].Ignore, []string{"node_modules/"})
65 assert.Equal(t, dev.Watch[0].InitialSync, true)
66
67 assert.Equal(t, dev.Watch[1].Path, "./requirements.txt")
68 assert.Equal(t, dev.Watch[1].Action, types.WatchActionRebuild)
69
70 assert.Equal(t, dev.Watch[2].Path, "./config.yml")
71 assert.Equal(t, dev.Watch[2].Action, types.WatchActionSyncRestart)
72 assert.Equal(t, dev.Watch[2].Target, "/app/config.yml")
73}
74
75func TestDevelopMissingAction(t *testing.T) {
76 _, err := loader.LoadWithContext(context.TODO(), types.ConfigDetails{

Callers

nothing calls this directly

Calls 1

LoadWithContextFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…