Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extensions for DevelopConfig #551

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,18 +305,40 @@ func TestLoadFromFile(t *testing.T) {
func TestLoadExtensions(t *testing.T) {
actual, err := loadYAML(`
name: load-extensions
x-project: project

configs:
x-config-name:
external: true
x-config-ext: config
services:
foo:
image: busybox
x-foo: bar`)
x-foo: bar
healthcheck:
x-healthcheck: health
develop:
x-dev: dev`)
assert.NilError(t, err)
assert.Check(t, is.DeepEqual(types.Extensions{
"x-project": "project",
}, actual.Extensions))
assert.Check(t, is.Len(actual.Services, 1))
service := actual.Services["foo"]
assert.Check(t, is.Equal("busybox", service.Image))
extras := types.Extensions{

assert.Check(t, is.DeepEqual(types.Extensions{
"x-foo": "bar",
}
assert.Check(t, is.DeepEqual(extras, service.Extensions))
}, service.Extensions))
assert.Check(t, is.DeepEqual(types.Extensions{
"x-config-ext": "config",
}, actual.Configs["x-config-name"].Extensions))
assert.Check(t, is.DeepEqual(types.Extensions{
"x-dev": "dev",
}, service.Develop.Extensions))
assert.Check(t, is.DeepEqual(types.Extensions{
"x-healthcheck": "health",
}, service.HealthCheck.Extensions))
}

func TestLoadExtends(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions types/develop.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package types

type DevelopConfig struct {
Watch []Trigger `json:"watch,omitempty"`

Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
}

type WatchAction string
Expand Down
Loading