1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/image/compat_test.go
John Starks 194eaa5c0f Add os_version and os_features to Image
These fields are needed to specify the exact version of Windows that an
image can run on. They may be useful for other platforms in the future.

This also changes image.store.Create to validate that the loaded image is
supported on the current machine. This change affects Linux as well, since
it now validates the architecture and OS fields.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-04-04 13:14:57 -07:00

28 lines
639 B
Go

package image
import (
"runtime"
"testing"
)
func TestValidateOSCompatibility(t *testing.T) {
err := ValidateOSCompatibility(runtime.GOOS, runtime.GOARCH, getOSVersion(), nil)
if err != nil {
t.Error(err)
}
err = ValidateOSCompatibility("DOS", runtime.GOARCH, getOSVersion(), nil)
if err == nil {
t.Error("expected OS compat error")
}
err = ValidateOSCompatibility(runtime.GOOS, "pdp-11", getOSVersion(), nil)
if err == nil {
t.Error("expected architecture compat error")
}
err = ValidateOSCompatibility(runtime.GOOS, runtime.GOARCH, "98 SE", nil)
if err == nil {
t.Error("expected OS version compat error")
}
}