mirror of
https://github.com/containers/podman.git
synced 2025-10-16 18:53:19 +08:00
hooks: Order injection by collated JSON filename
We also considered ordering with sort.Strings, but Matthew rejected that because it uses a byte-by-byte UTF-8 comparison [1] which would fail many language-specific conventions [2]. There's some more discussion of the localeToLanguage mapping in [3]. Currently language.Parse does not handle either 'C' or 'POSIX', returning: und, language: tag is not well-formed for both. [1]: https://github.com/projectatomic/libpod/pull/686#issuecomment-387914358 [2]: https://en.wikipedia.org/wiki/Alphabetical_order#Language-specific_conventions [3]: https://github.com/golang/go/issues/25340 Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #686 Approved by: mheon
This commit is contained in:

committed by
Atomic Bot

parent
4b22913e11
commit
89430ffe65
@ -11,6 +11,7 @@ import (
|
||||
|
||||
rspec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
func TestMonitorGood(t *testing.T) {
|
||||
@ -21,7 +22,12 @@ func TestMonitorGood(t *testing.T) {
|
||||
}
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
manager, err := New(ctx, []string{dir})
|
||||
lang, err := language.Parse("und-u-va-posix")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
manager, err := New(ctx, []string{dir}, lang)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -114,7 +120,13 @@ func TestMonitorGood(t *testing.T) {
|
||||
|
||||
func TestMonitorBadWatcher(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
manager, err := New(ctx, []string{})
|
||||
|
||||
lang, err := language.Parse("und-u-va-posix")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
manager, err := New(ctx, []string{}, lang)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user