Merge pull request #6497 from thaJeztah/platform_keep_osversion_osfeatures

platforms.Normalize(): do not reset OSVersion and OSFeatures
This commit is contained in:
Derek McGowan 2022-02-02 12:06:09 -08:00 committed by GitHub
commit 604c462d7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -257,10 +257,5 @@ func Format(platform specs.Platform) string {
func Normalize(platform specs.Platform) specs.Platform { func Normalize(platform specs.Platform) specs.Platform {
platform.OS = normalizeOS(platform.OS) platform.OS = normalizeOS(platform.OS)
platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant) platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant)
// these fields are deprecated, remove them
platform.OSFeatures = nil
platform.OSVersion = ""
return platform return platform
} }

View File

@ -23,6 +23,7 @@ import (
"testing" "testing"
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/require"
) )
func TestParseSelector(t *testing.T) { func TestParseSelector(t *testing.T) {
@ -364,3 +365,7 @@ func TestParseSelectorInvalid(t *testing.T) {
}) })
} }
} }
func TestNormalize(t *testing.T) {
require.Equal(t, DefaultSpec(), Normalize(DefaultSpec()))
}