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
31 changes: 31 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2354,3 +2354,34 @@ func TestInvalidProjectNameType(t *testing.T) {
assert.Error(t, err, "validating filename0.yml: name must be a string")
assert.Assert(t, is.Nil(p))
}

func TestNumericIDs(t *testing.T) {
p, err := loadYAML(`
name: 'test-numeric-ids'
services:
foo:
image: busybox
volumes:
- 0:/foo

volumes:
'0': {}
`)
assert.NilError(t, err)
assert.DeepEqual(t, p.Services, types.Services{
{
Name: "foo",
Image: "busybox",
Environment: types.MappingWithEquals{},
Scale: 1,
Volumes: []types.ServiceVolumeConfig{
{
Type: types.VolumeTypeVolume,
Source: "0",
Target: "/foo",
Volume: &types.ServiceVolumeVolume{},
},
},
},
})
}
3 changes: 3 additions & 0 deletions loader/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,8 @@ func isFilePath(source string) bool {
}

first, nextIndex := utf8.DecodeRuneInString(source)
if len(source) <= nextIndex {
return false
}
return isWindowsDrive([]rune{first}, rune(source[nextIndex]))
}