Skip to content
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
19 changes: 19 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2942,3 +2942,22 @@ services:
"nofile": {Soft: 20000, Hard: 40000},
})
}

func TestServiceNameWithDots(t *testing.T) {
yaml := `
name: test-service-name-with-dots
services:
test.a.b.c:
image: foo
ports:
- "5432"
`
_, err := LoadWithContext(context.Background(), types.ConfigDetails{
ConfigFiles: []types.ConfigFile{
{
Content: []byte(yaml),
},
},
})
assert.NilError(t, err)
}
5 changes: 5 additions & 0 deletions tree/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (p Path) Next(part string) Path {
if p == "" {
return Path(part)
}
part = strings.ReplaceAll(part, pathSeparator, "👻")
return Path(string(p) + pathSeparator + part)
}

Expand Down Expand Up @@ -80,3 +81,7 @@ func (p Path) Parent() Path {
}
return ""
}

func (p Path) String() string {
return strings.ReplaceAll(string(p), "👻", pathSeparator)
}