Skip to content

Commit

Permalink
Merge pull request #122 from AkihiroSuda/fix-pull-policy
Browse files Browse the repository at this point in the history
fix service.pull_policy
  • Loading branch information
ndeloof authored Apr 15, 2021
2 parents e358952 + 6e8cd8e commit 1091323
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1730,3 +1730,16 @@ services:
`)
assert.ErrorContains(t, err, "invalid string value for 'count' (the only value allowed is 'all')")
}

func TestServicePullPolicy(t *testing.T) {
actual, err := loadYAML(`
services:
hello-world:
image: redis:alpine
pull_policy: always
`)
assert.NilError(t, err)
svc, err := actual.GetService("hello-world")
assert.NilError(t, err)
assert.Equal(t, "always", svc.PullPolicy)
}
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ type ServiceConfig struct {
Platform string `yaml:",omitempty" json:"platform,omitempty"`
Ports []ServicePortConfig `yaml:",omitempty" json:"ports,omitempty"`
Privileged bool `yaml:",omitempty" json:"privileged,omitempty"`
PullPolicy string `yaml:",omitempty" json:"pull_policy,omitempty"`
PullPolicy string `mapstructure:"pull_policy" yaml:"pull_policy,omitempty" json:"pull_policy,omitempty"`
ReadOnly bool `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
Restart string `yaml:",omitempty" json:"restart,omitempty"`
Runtime string `yaml:",omitempty" json:"runtime,omitempty"`
Expand Down

0 comments on commit 1091323

Please sign in to comment.