compose-spec / compose-go

Reference library for parsing and loading Compose YAML files

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

loader panic

nicks opened this issue · comments

Add the following test to loader_test:

func TestBadServiceConfig(t *testing.T) {
	yaml := `name: scratch
services:
  redis:
    image: redis:6.2.6-alpine
    network_mode: bridge
    networks:
      gratheon: null
networks:
  gratheon:
    name: scratch_gratheon
`
	_, _ = LoadWithContext(context.Background(), types.ConfigDetails{
		ConfigFiles: []types.ConfigFile{
			{
				Content: []byte(yaml),
			},
		},
	})
}

Expected result:
Loader emits a reasonable error

Actual result:
Loader panics

--- FAIL: TestBadServiceConfig (0.00s)
panic: assignment to entry in nil map [recovered]
	panic: assignment to entry in nil map

distilled from tilt-dev/tilt#6249