(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestDevelopWatch(t *testing.T) { |
| 29 | p, err := loader.LoadWithContext(context.TODO(), types.ConfigDetails{ |
| 30 | ConfigFiles: []types.ConfigFile{{Filename: "compose.yml", Content: []byte(` |
| 31 | name: test |
| 32 | services: |
| 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 | |
| 75 | func TestDevelopMissingAction(t *testing.T) { |
| 76 | _, err := loader.LoadWithContext(context.TODO(), types.ConfigDetails{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…