From b97ac6e620363caa661c6c802716d9fd1aaaa0cc Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Tue, 4 Jan 2022 11:19:35 -0500 Subject: [PATCH 1/5] Updating functional tests Updated `./tests/functional` to: - use command line arguments to configure tests - use `ctr.exe` to find the layer path for images - better delineate between utilities and test with config - added client to interact with containerd directly Signed-off-by: Hamza El-Saawy --- test/functional/lcow_test.go | 22 ++-- test/functional/main_test.go | 106 ++++++++++++++++++ test/functional/test.go | 53 --------- test/functional/utilities/constants.go | 12 +++ test/functional/utilities/containerd.go | 112 ++++++++++++++++++++ test/functional/utilities/createuvm.go | 11 +- test/functional/utilities/ctrclient.go | 58 ++++++++++ test/functional/utilities/layerfolders.go | 106 +++++++++++++----- test/functional/utilities/scratch.go | 6 +- test/functional/utilities/tempdir.go | 15 --- test/functional/uvm.go | 24 +++++ test/functional/uvm_mem_backingtype_test.go | 4 +- test/functional/uvm_memory_test.go | 5 +- test/functional/uvm_plannine_test.go | 24 ++++- test/functional/uvm_properties_test.go | 2 +- test/functional/uvm_scratch_test.go | 10 +- test/functional/uvm_scsi_test.go | 2 +- test/functional/uvm_virtualdevice_test.go | 3 +- test/functional/uvm_vpmem_test.go | 7 +- test/functional/uvm_vsmb_test.go | 4 +- test/functional/wcow_test.go | 44 ++------ test/runhcs/e2e_matrix_test.go | 10 +- 22 files changed, 461 insertions(+), 179 deletions(-) create mode 100644 test/functional/main_test.go delete mode 100644 test/functional/test.go create mode 100644 test/functional/utilities/constants.go create mode 100644 test/functional/utilities/containerd.go create mode 100644 test/functional/utilities/ctrclient.go delete mode 100644 test/functional/utilities/tempdir.go create mode 100644 test/functional/uvm.go diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index 42a63796a7..bf767ea280 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -1,3 +1,4 @@ +//go:build functional || lcow // +build functional lcow package functional @@ -6,7 +7,6 @@ import ( "bytes" "context" "fmt" - "os" "os/exec" "path/filepath" "strings" @@ -26,7 +26,7 @@ import ( // TestLCOWUVMNoSCSINoVPMemInitrd starts an LCOW utility VM without a SCSI controller and // no VPMem device. Uses initrd. func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLcowUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 0 opts.PreferredRootFSType = uvm.PreferredRootFSTypeInitRd @@ -38,7 +38,7 @@ func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { // TestLCOWUVMNoSCSISingleVPMemVHD starts an LCOW utility VM without a SCSI controller and // only a single VPMem device. Uses VPMEM VHD func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLcowUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 1 opts.PreferredRootFSType = uvm.PreferredRootFSTypeVHD @@ -96,7 +96,7 @@ func TestLCOWUVMStart_KernelDirect_InitRd(t *testing.T) { func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.PreferredRootFSType) { for i := 0; i < 3; i++ { - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLcowUvmOptions(t, t.Name()) opts.KernelDirect = kernelDirect opts.VPMemDeviceCount = 32 opts.PreferredRootFSType = rfsType @@ -117,26 +117,22 @@ func TestLCOWSimplePodScenario(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) alpineLayers := testutilities.LayerFolders(t, "alpine") - cacheDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(cacheDir) + cacheDir := t.TempDir() cacheFile := filepath.Join(cacheDir, "cache.vhdx") // This is what gets mounted into /tmp/scratch - uvmScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(uvmScratchDir) + uvmScratchDir := t.TempDir() uvmScratchFile := filepath.Join(uvmScratchDir, "uvmscratch.vhdx") // Scratch for the first container - c1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(c1ScratchDir) + c1ScratchDir := t.TempDir() c1ScratchFile := filepath.Join(c1ScratchDir, "sandbox.vhdx") // Scratch for the second container - c2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(c2ScratchDir) + c2ScratchDir := t.TempDir() c2ScratchFile := filepath.Join(c2ScratchDir, "sandbox.vhdx") - lcowUVM := testutilities.CreateLCOWUVM(context.Background(), t, "uvm") + lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "uvm")) defer lcowUVM.Close() // Populate the cache and generate the scratch file for /tmp/scratch diff --git a/test/functional/main_test.go b/test/functional/main_test.go new file mode 100644 index 0000000000..f9a20a36cf --- /dev/null +++ b/test/functional/main_test.go @@ -0,0 +1,106 @@ +package functional + +import ( + "context" + "flag" + "os" + "os/exec" + "strconv" + "testing" + "time" + + "github.com/Microsoft/hcsshim/internal/cow" + "github.com/Microsoft/hcsshim/internal/hcsoci" + "github.com/Microsoft/hcsshim/internal/resources" + testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/containerd/containerd" + "github.com/sirupsen/logrus" +) + +const ( + bytesPerMB = 1024 * 1024 +) + +var ( + debug bool + pauseDurationOnCreateContainerFailure time.Duration + + // flags + flagContainerdEndpoint = flag.String("ctr-endpoint", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") + flagContainerdNamespace = flag.String("ctr-namespace", "k8s.io", "Containerd namespace") + flagCtrPath = flag.String("ctr-path", testutilities.DefaultCtrPath(), "Path to ctr.exe") + flagLinuxBootFilesPath = flag.String("linux-bootfiles", + "C:\\ContainerPlat\\LinuxBootFiles", + "Path to LCOW UVM boot files (rootfs.vhd, initrd.img, kernel, etc.)") +) + +func init() { + if len(os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG")) > 0 { + debug = true + } + flag.BoolVar(&debug, "debug", debug, "Set logging level to debug [%%HCSSHIM_FUNCTIONAL_TESTS_DEBUG%%]") + + // This allows for debugging a utility VM. + if s := os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES"); s != "" { + if t, err := strconv.Atoi(s); err == nil { + pauseDurationOnCreateContainerFailure = time.Duration(t) * time.Minute + } + } + flag.DurationVar(&pauseDurationOnCreateContainerFailure, + "container-creation-failure-pause", + pauseDurationOnCreateContainerFailure, + "The number of minutes to wait after a container creation failure to try again "+ + "[%%HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES%%]") + + if debug { + logrus.SetLevel(logrus.DebugLevel) + logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) + } + + // Try to stop any pre-existing compute processes + cmd := exec.Command("powershell", `get-computeprocess | stop-computeprocess -force`) + _ = cmd.Run() + +} + +func TestMain(m *testing.M) { + flag.Parse() + + ctro := testutilities.GetCtrClientOptions() + ctro.Path = *flagCtrPath + ctro.Address = *flagContainerdEndpoint + ctro.Namespace = *flagContainerdNamespace + + os.Exit(m.Run()) +} + +func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptions) (cow.Container, *resources.Resources, error) { + if pauseDurationOnCreateContainerFailure != 0 { + options.DoNotReleaseResourcesOnFailure = true + } + s, r, err := hcsoci.CreateContainer(ctx, options) + if err != nil { + logrus.Warnf("Test is pausing for %s for debugging CreateContainer failure", pauseDurationOnCreateContainerFailure) + time.Sleep(pauseDurationOnCreateContainerFailure) + _ = resources.ReleaseResources(ctx, r, options.HostingSystem, true) + } + return s, r, err +} + +func getCtrOptions() testutilities.CtrClientOptions { + return testutilities.CtrClientOptions{ + Path: *flagLinuxBootFilesPath, + CtrdClientOptions: getCtrdOptions(), + } +} + +func getCtrdOptions() testutilities.CtrdClientOptions { + return testutilities.CtrdClientOptions{ + Address: *flagContainerdEndpoint, + Namespace: *flagContainerdNamespace, + } +} + +func getCtrdClient(t *testing.T) (*containerd.Client, context.Context) { + return getCtrdOptions().NewClient(context.Background(), t) +} \ No newline at end of file diff --git a/test/functional/test.go b/test/functional/test.go deleted file mode 100644 index 28314d4928..0000000000 --- a/test/functional/test.go +++ /dev/null @@ -1,53 +0,0 @@ -package functional - -import ( - "context" - "os" - "os/exec" - "strconv" - "time" - - "github.com/Microsoft/hcsshim/internal/cow" - "github.com/Microsoft/hcsshim/internal/hcsoci" - "github.com/Microsoft/hcsshim/internal/resources" - "github.com/sirupsen/logrus" -) - -const ( - bytesPerMB = 1024 * 1024 -) - -var pauseDurationOnCreateContainerFailure time.Duration - -func init() { - if len(os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG")) > 0 { - logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - } - - // This allows for debugging a utility VM. - s := os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES") - if s != "" { - if t, err := strconv.Atoi(s); err == nil { - pauseDurationOnCreateContainerFailure = time.Duration(t) * time.Minute - } - } - - // Try to stop any pre-existing compute processes - cmd := exec.Command("powershell", `get-computeprocess | stop-computeprocess -force`) - _ = cmd.Run() - -} - -func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptions) (cow.Container, *resources.Resources, error) { - if pauseDurationOnCreateContainerFailure != 0 { - options.DoNotReleaseResourcesOnFailure = true - } - s, r, err := hcsoci.CreateContainer(ctx, options) - if err != nil { - logrus.Warnf("Test is pausing for %s for debugging CreateContainer failure", pauseDurationOnCreateContainerFailure) - time.Sleep(pauseDurationOnCreateContainerFailure) - _ = resources.ReleaseResources(ctx, r, options.HostingSystem, true) - } - return s, r, err -} diff --git a/test/functional/utilities/constants.go b/test/functional/utilities/constants.go new file mode 100644 index 0000000000..c586f467a7 --- /dev/null +++ b/test/functional/utilities/constants.go @@ -0,0 +1,12 @@ +package testutilities + +import "time" + +const ( + connectTimeout = time.Second * 10 + + PlatformWindows = "windows" + PlatformLinux = "linux" + SnapshotterWindows = "windows" + SnapshotterLinux = "windows-lcow" +) \ No newline at end of file diff --git a/test/functional/utilities/containerd.go b/test/functional/utilities/containerd.go new file mode 100644 index 0000000000..1355e117e4 --- /dev/null +++ b/test/functional/utilities/containerd.go @@ -0,0 +1,112 @@ +package testutilities + +import ( + "context" + "testing" + + "github.com/containerd/containerd" + kubeutil "github.com/containerd/containerd/integration/remote/util" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/namespaces" + "github.com/containerd/containerd/platforms" + "github.com/containerd/containerd/snapshots" + "github.com/opencontainers/image-spec/identity" + "google.golang.org/grpc" +) + +// default containerd.New(address) does not connect to tcp endpoints on windows +func createGRPCConn(ctx context.Context, address string) (*grpc.ClientConn, error) { + addr, dialer, err := kubeutil.GetAddressAndDialer(address) + if err != nil { + return nil, err + } + return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer)) +} + +type CtrdClientOptions struct { + Address string + Namespace string +} + +func (cco CtrdClientOptions) defaultOpts() []containerd.ClientOpt { + return []containerd.ClientOpt{containerd.WithDefaultNamespace(cco.Namespace)} +} + +// returned context is how namespaces are passed to various containerd client calls +func (cco CtrdClientOptions) NewClient(ctx context.Context, t *testing.T, opts ...containerd.ClientOpt) (*containerd.Client, context.Context) { + // regular `New` does not work on windows, need to use `WithConn` + cctx, ccancel := context.WithTimeout(ctx, connectTimeout) + defer ccancel() + + conn, err := createGRPCConn(cctx, cco.Address) + if err != nil { + t.Fatalf("failed to dial runtime client: %v", err) + } + + opts = append(opts, cco.defaultOpts()...) + c, err := containerd.NewWithConn(conn, opts...) + if err != nil { + t.Fatalf("containerd.New() client failed: %v", err) + } + t.Cleanup(func(){c.Close()}) + + ctx = namespaces.WithNamespace(ctx, cco.Namespace) + ctx, cancel := context.WithCancel(ctx) + t.Cleanup(cancel) + + return c, ctx +} + + +func GetPlatformComparer(t *testing.T, platform string) platforms.MatchComparer { + var p platforms.MatchComparer + if platform == "" { + p = platforms.All + } else { + pp, err := platforms.Parse(platform) + if err != nil { + t.Fatalf("could not parse platform %q: %v", platform, err) + } + p = platforms.Only(pp) + } + + return p +} + +// GetImageChainID gets the chain id of an image. platform can be "". +func GetImageChainID(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) string { + is := client.ImageService() + + i, err := is.Get(ctx, image) + if err != nil { + t.Fatalf("could not retrieve image %q: %v", image, err) + } + + p := GetPlatformComparer(t, platform) + + diffIDs, err := i.RootFS(ctx, client.ContentStore(), p) + if err != nil { + t.Fatalf("could not retrieve unpacked diff ids: %v", err) + } + chainID := identity.ChainID(diffIDs).String() + return chainID +} + + +func CreateActiveSnapshot(ctx context.Context, t *testing.T, client *containerd.Client, snapshotter, parent, key string, opts ...snapshots.Opt) []mount.Mount { + ss := client.SnapshotService(snapshotter) + + ms, err := ss.Prepare(ctx, key, parent, opts...) + if err != nil { + t.Fatalf("could not make active snapshot %q from %q: %v", key, parent, err) + } + + t.Cleanup(func(){ + err = ss.Remove(ctx, key) + if err != nil { + t.Fatalf("failed to remove active commit %q", key) + } + }) + + return ms +} \ No newline at end of file diff --git a/test/functional/utilities/createuvm.go b/test/functional/utilities/createuvm.go index 8587fdef42..f6654f66c3 100644 --- a/test/functional/utilities/createuvm.go +++ b/test/functional/utilities/createuvm.go @@ -41,12 +41,7 @@ func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, opts *uvm } uvmLayers := LayerFolders(t, image) - scratchDir := CreateTempDir(t) - defer func() { - if t.Failed() { - os.RemoveAll(scratchDir) - } - }() + scratchDir := t.TempDir() opts.LayerFolders = append(opts.LayerFolders, uvmLayers...) opts.LayerFolders = append(opts.LayerFolders, scratchDir) @@ -67,11 +62,11 @@ func CreateLCOWUVMFromOpts(ctx context.Context, t *testing.T, opts *uvm.OptionsL uvm, err := uvm.CreateLCOW(ctx, opts) if err != nil { - t.Fatal(err) + t.Fatalf("could not create LCOW UVM: %v", err) } if err := uvm.Start(ctx); err != nil { uvm.Close() - t.Fatal(err) + t.Fatalf("could not start LCOW UVM: %v", err) } return uvm } diff --git a/test/functional/utilities/ctrclient.go b/test/functional/utilities/ctrclient.go new file mode 100644 index 0000000000..37accf3cb9 --- /dev/null +++ b/test/functional/utilities/ctrclient.go @@ -0,0 +1,58 @@ +package testutilities + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" +) + +func DefaultCtrPath() string { + return filepath.Join(filepath.Dir(os.Args[0]), "ctr.exe") +} + +// Global options for connecting to ctr.exe +// Flags are passed to parent module, cannot import them here without causing circular dependencies +// todo: restructure `LayerFolders` and `CreateWCOWUVM*` functions to use CtrClientOptions +// or move `utilities/*` into parent path, similar to `tests/cri-containerd` + +type CtrClientOptions struct { + CtrdClientOptions + Path string +} + +var ctro CtrClientOptions + +func GetCtrClientOptions() *CtrClientOptions { + return &ctro +} + +func (co CtrClientOptions) Command(ctx context.Context,arg ...string) *exec.Cmd { + args := []string{ + "--address", + co.Address, + "--namespace", + co.Namespace, + } + args = append(args, arg...) + cmd := exec.CommandContext(ctx, co.Path, args...) + return cmd +} + +func (co CtrClientOptions) PullImage(ctx context.Context, snapshotter, image string) error { + cmd := co.Command(ctx, "images", + "pull", + "--snapshotter", + snapshotter, + "view", + image) + if err := cmd.Run(); err != nil { + return fmt.Errorf("Failed to pull image %q with %v. Command was %v", image, err, cmd) + } + return nil +} + +func CtrCommand(arg ...string) *exec.Cmd { + return ctro.Command(context.Background(), arg...) +} diff --git a/test/functional/utilities/layerfolders.go b/test/functional/utilities/layerfolders.go index 6fc23dd049..d3a0fe0ba3 100644 --- a/test/functional/utilities/layerfolders.go +++ b/test/functional/utilities/layerfolders.go @@ -3,52 +3,108 @@ package testutilities import ( "bytes" "encoding/json" - "io/ioutil" - "os" - "os/exec" - "path/filepath" + "regexp" "strings" "testing" + + "github.com/containerd/containerd/mount" ) -var imageLayers map[string][]string +var ( + imageLayers map[string][]string + chainIDRe = regexp.MustCompile(`image chain ID:\s+([a-z0-9:]+)\n`) +) func init() { imageLayers = make(map[string][]string) } +func getSnapshotterName(platform string) string { + if platform == PlatformWindows { + return SnapshotterWindows + } + return SnapshotterLinux +} + func LayerFolders(t *testing.T, imageName string) []string { + return LayerFoldersPlatform(t, imageName, PlatformWindows) +} + +func LayerFoldersPlatform(t *testing.T, imageName, platform string) []string { if _, ok := imageLayers[imageName]; !ok { - imageLayers[imageName] = getLayers(t, imageName) + imageLayers[imageName] = getLayers(t, imageName, platform) } return imageLayers[imageName] } -func getLayers(t *testing.T, imageName string) []string { - cmd := exec.Command("docker", "inspect", imageName, "-f", `"{{.GraphDriver.Data.dir}}"`) +func getLayers(t *testing.T, imageName, platform string) []string { var out bytes.Buffer + snapshotter := getSnapshotterName(platform) + pullCmd := CtrCommand("images", + "pull", + "--snapshotter", + snapshotter, + "view", + "--mounts", + imageName) + pullCmd.Stdout = &out + if err := pullCmd.Run(); err != nil { + t.Skipf("Failed to pull image %q with %v. Command was %v", imageName, err, pullCmd) + } + ms := chainIDRe.FindAllStringSubmatch(out.String(), -1) + if len(ms) != 1 { + t.Skipf("Failed to find chain id in output, matches are %q", ms) + } + chainID := ms[0][1] + viewName := chainID + "View" + + cmd := CtrCommand("snapshot", + "--snapshotter", + snapshotter, + "view", + "--mounts", + viewName, + chainID) + + out.Reset() cmd.Stdout = &out if err := cmd.Run(); err != nil { - t.Skipf("Failed to find layers for %q. Check docker images", imageName) + t.Skipf("Failed to find layers for %q with %v. Command was %v", chainID, err, cmd) } - imagePath := strings.Replace(strings.TrimSpace(out.String()), `"`, ``, -1) - layers := getLayerChain(t, imagePath) - return append([]string{imagePath}, layers...) -} + defer removeSnapshot(t, viewName, snapshotter) -func getLayerChain(t *testing.T, layerFolder string) []string { - jPath := filepath.Join(layerFolder, "layerchain.json") - content, err := ioutil.ReadFile(jPath) - if os.IsNotExist(err) { - t.Fatalf("layerchain not found") - } else if err != nil { - t.Fatalf("failed to read layerchain") + mounts := []mount.Mount{} + if err := json.Unmarshal(out.Bytes(), &mounts); err != nil { + t.Skipf("Failed to parse layers for snapshot %q", chainID) } - var layerChain []string - err = json.Unmarshal(content, &layerChain) - if err != nil { - t.Fatalf("failed to unmarshal layerchain") + if len(mounts) != 1 { + t.Skip("Rootfs does not contain exactly 1 mount for the root file system") + } + + // setup layer folders + m := mounts[0] + var layerFolders []string + for _, option := range m.Options { + if strings.HasPrefix(option, mount.ParentLayerPathsFlag) { + err := json.Unmarshal([]byte(option[len(mount.ParentLayerPathsFlag):]), &layerFolders) + if err != nil { + t.Skipf("failed to unmarshal parent layer paths from mount: %v", err) + } + } + } + layerFolders = append(layerFolders, m.Source) + return layerFolders +} + +func removeSnapshot(t *testing.T, image, snapshotter string) { + cmd := CtrCommand("snapshot", + "--snapshotter", + snapshotter, + "rm", + image) + + if err := cmd.Run(); err != nil { + t.Logf("Could not remove image %q: %v", image, err) } - return layerChain } diff --git a/test/functional/utilities/scratch.go b/test/functional/utilities/scratch.go index e7cf11028a..c35d4e91db 100644 --- a/test/functional/utilities/scratch.go +++ b/test/functional/utilities/scratch.go @@ -35,7 +35,7 @@ func CreateWCOWBlankRWLayer(t *testing.T, imageLayers []string) string { // t.Fatalf("failed to locate UVM folder from %+v: %s", imageLayers, err) // } - tempDir := CreateTempDir(t) + tempDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), tempDir, imageLayers); err != nil { t.Fatalf("Failed CreateScratchLayer: %s", err) } @@ -48,9 +48,9 @@ func CreateWCOWBlankRWLayer(t *testing.T, imageLayers []string) string { func CreateLCOWBlankRWLayer(ctx context.Context, t *testing.T) string { if lcowGlobalSVM == nil { lcowGlobalSVM = CreateLCOWUVM(ctx, t, lcowGlobalSVMID) - lcowCacheScratchFile = filepath.Join(CreateTempDir(t), "sandbox.vhdx") + lcowCacheScratchFile = filepath.Join(t.TempDir(), "sandbox.vhdx") } - tempDir := CreateTempDir(t) + tempDir := t.TempDir() if err := lcow.CreateScratch(ctx, lcowGlobalSVM, filepath.Join(tempDir, "sandbox.vhdx"), lcow.DefaultScratchSizeGB, lcowCacheScratchFile); err != nil { t.Fatalf("failed to create EXT4 scratch for LCOW test cases: %s", err) diff --git a/test/functional/utilities/tempdir.go b/test/functional/utilities/tempdir.go deleted file mode 100644 index ebbe6ae533..0000000000 --- a/test/functional/utilities/tempdir.go +++ /dev/null @@ -1,15 +0,0 @@ -package testutilities - -import ( - "io/ioutil" - "testing" -) - -// CreateTempDir creates a temporary directory -func CreateTempDir(t *testing.T) string { - tempDir, err := ioutil.TempDir("", "test") - if err != nil { - t.Fatalf("failed to create temporary directory: %s", err) - } - return tempDir -} diff --git a/test/functional/uvm.go b/test/functional/uvm.go new file mode 100644 index 0000000000..465b4b29b3 --- /dev/null +++ b/test/functional/uvm.go @@ -0,0 +1,24 @@ +//go:build functional + +package functional + +import ( + "testing" + + "github.com/Microsoft/hcsshim/internal/uvm" +) + +// default options using command line flags, if any + +func getDefaultLcowUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { + opts := uvm.NewDefaultOptionsLCOW(name, "") + opts.BootFilesPath = *flagLinuxBootFilesPath + + return opts +} + +func getDefaultWcowUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { + opts := uvm.NewDefaultOptionsWCOW(name, "") + + return opts +} \ No newline at end of file diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index 6adc97c646..13aca48517 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -39,13 +39,13 @@ func runMemTests(t *testing.T, os string) { for _, bt := range testCases { if os == "windows" { - wopts := uvm.NewDefaultOptionsWCOW(t.Name(), "") + wopts := getDefaultWcowUvmOptions(t, t.Name()) wopts.MemorySizeInMB = 512 wopts.AllowOvercommit = bt.allowOvercommit wopts.EnableDeferredCommit = bt.enableDeferredCommit runMemStartWCOWTest(t, wopts) } else { - lopts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + lopts := getDefaultLcowUvmOptions(t, t.Name()) lopts.MemorySizeInMB = 512 lopts.AllowOvercommit = bt.allowOvercommit lopts.EnableDeferredCommit = bt.enableDeferredCommit diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index bc1ecd5ea9..bb75dc57e7 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" ) @@ -17,7 +16,7 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) defer cancel() - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLcowUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 u := testutilities.CreateLCOWUVMFromOpts(ctx, t, opts) defer u.Close() @@ -42,7 +41,7 @@ func TestUVMMemoryUpdateWCOW(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) defer cancel() - opts := uvm.NewDefaultOptionsWCOW(t.Name(), "") + opts := getDefaultWcowUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, opts, "mcr.microsoft.com/windows/nanoserver:1909") diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index 55e63375c0..d94bb1902a 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmp9 // +build functional uvmp9 // This file isn't called uvm_plan9_test.go as go test skips when a number is in it... go figure (pun intended) @@ -7,7 +8,6 @@ package functional import ( "context" "fmt" - "os" "path/filepath" "testing" @@ -21,14 +21,14 @@ import ( func TestPlan9(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - vm := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) defer vm.Close() - dir := testutilities.CreateTempDir(t) - defer os.RemoveAll(dir) var iterations uint32 = 64 var shares []*uvm.Plan9Share for i := 0; i < int(iterations); i++ { + // create a new temp dir per mount, to avoid "failed to remove plan9 share: device or resource busy" errors + dir := t.TempDir() share, err := vm.AddPlan9(context.Background(), dir, fmt.Sprintf("/tmp/%s", filepath.Base(dir)), false, false, nil) if err != nil { t.Fatalf("AddPlan9 failed: %s", err) @@ -43,3 +43,19 @@ func TestPlan9(t *testing.T) { } } } + +func Test_Setup(t *testing.T) { + client, ctx := getCtrdClient(t) + + is := []string{ + "mcr.microsoft.com/windows/nanoserver:1903", + "mcr.microsoft.com/windows/nanoserver:2004", + "mcr.microsoft.com/windows/nanoserver:ltsc2022", + } + for _, i := range is { + cid := testutilities.GetImageChainID(ctx, t, client, i, "windows") + ms := testutilities.CreateActiveSnapshot(ctx, t, client, "windows", cid, t.Name()) + t.Logf("%+v", ms) + } + +} diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index 34baa35607..f9e4412260 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -14,7 +14,7 @@ import ( func TestPropertiesGuestConnection_LCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - uvm := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) defer uvm.Close() p, gc := uvm.Capabilities() diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index 3ab78198e7..cf28292f6c 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmscratch // +build functional uvmscratch package functional @@ -16,10 +17,9 @@ import ( func TestScratchCreateLCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - tempDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(tempDir) + tempDir := t.TempDir() - firstUVM := testutilities.CreateLCOWUVM(context.Background(), t, "TestCreateLCOWScratch") + firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch")) defer firstUVM.Close() cacheFile := filepath.Join(tempDir, "cache.vhdx") @@ -36,7 +36,7 @@ func TestScratchCreateLCOW(t *testing.T) { t.Fatalf("cacheFile wasn't created!") } - targetUVM := testutilities.CreateLCOWUVM(context.Background(), t, "TestCreateLCOWScratch_target") + targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch_target")) defer targetUVM.Close() // A non-cached create @@ -61,7 +61,7 @@ func TestScratchCreateLCOW(t *testing.T) { //// VHDX and format it ext4. //func TestCreateLCOWScratch(t *testing.T) { // t.Skip("for now") -// cacheDir := createTempDir(t) +// cacheDir := t.TempDir() // cacheFile := filepath.Join(cacheDir, "cache.vhdx") // uvm, err := CreateContainer(&CreateOptions{Spec: getDefaultLinuxSpec(t)}) // if err != nil { diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index 60a27dd38a..f6467696a7 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -215,7 +215,7 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string func TestParallelScsiOps(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) defer u.Close() // Create a sandbox to use diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index 2afb95785e..df4403d2e6 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package functional @@ -42,7 +43,7 @@ func TestVirtualDevice(t *testing.T) { } // update opts needed to assign a hyper-v pci device - opts := uvm.NewDefaultOptionsLCOW(t.Name(), "") + opts := getDefaultLcowUvmOptions(t, t.Name()) opts.VPCIEnabled = true opts.AllowOvercommit = false opts.KernelDirect = false diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index 3d55881e92..bafe38dbf2 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -1,10 +1,10 @@ +//go:build functional || uvmvpmem // +build functional uvmvpmem package functional import ( "context" - "os" "path/filepath" "testing" @@ -20,17 +20,16 @@ func TestVPMEM(t *testing.T) { alpineLayers := testutilities.LayerFolders(t, "alpine") ctx := context.Background() - u := testutilities.CreateLCOWUVM(ctx, t, t.Name()) + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, getDefaultLcowUvmOptions(t, t.Name())) defer u.Close() var iterations uint32 = uvm.MaxVPMEMCount // Use layer.vhd from the alpine image as something to add - tempDir := testutilities.CreateTempDir(t) + tempDir := t.TempDir() if err := copyfile.CopyFile(ctx, filepath.Join(alpineLayers[0], "layer.vhd"), filepath.Join(tempDir, "layer.vhd"), true); err != nil { t.Fatal(err) } - defer os.RemoveAll(tempDir) for i := 0; i < int(iterations); i++ { uvmPath, err := u.AddVPMem(ctx, filepath.Join(tempDir, "layer.vhd")) diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index 020f61ea51..5ab162e5cc 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmvsmb // +build functional uvmvsmb package functional @@ -18,8 +19,7 @@ func TestVSMB(t *testing.T) { defer os.RemoveAll(uvmScratchDir) defer uvm.Close() - dir := testutilities.CreateTempDir(t) - defer os.RemoveAll(dir) + dir := t.TempDir() var iterations uint32 = 64 options := uvm.DefaultVSMBOptions(true) options.TakeBackupPrivilege = true diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index c620ea6cc0..176d47261c 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -1,3 +1,4 @@ +//go:build functional || wcow // +build functional wcow package functional @@ -340,9 +341,9 @@ const imageName = "busyboxw" // Creates two temp folders used for the mounts/mapped directories func createTestMounts(t *testing.T) (string, string) { - // Create two temp folders for mapped directories. - hostRWSharedDirectory := testutilities.CreateTempDir(t) - hostROSharedDirectory := testutilities.CreateTempDir(t) + // Create two temp foldert.TempDir() + hostRWSharedDirectory := t.TempDir() + hostROSharedDirectory := t.TempDir() fRW, _ := os.OpenFile(filepath.Join(hostRWSharedDirectory, "readwrite"), os.O_RDWR|os.O_CREATE, 0755) fRO, _ := os.OpenFile(filepath.Join(hostROSharedDirectory, "readonly"), os.O_RDWR|os.O_CREATE, 0755) fRW.Close() @@ -364,16 +365,12 @@ func generateShimLayersStruct(t *testing.T, imageLayers []string) []hcsshim.Laye func TestWCOWArgonShim(t *testing.T) { imageLayers := testutilities.LayerFolders(t, imageName) argonShimMounted := false - - argonShimScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonShimScratchDir) + argonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) layers := generateShimLayersStruct(t, imageLayers) @@ -429,16 +426,12 @@ func TestWCOWArgonShim(t *testing.T) { // Xenon through HCSShim interface (v1) func TestWCOWXenonShim(t *testing.T) { imageLayers := testutilities.LayerFolders(t, imageName) - - xenonShimScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonShimScratchDir) + xenonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), xenonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) if err != nil { @@ -500,15 +493,12 @@ func generateWCOWOciTestSpec(t *testing.T, imageLayers []string, scratchPath, ho func TestWCOWArgonOciV1(t *testing.T) { imageLayers := testutilities.LayerFolders(t, imageName) argonOci1Mounted := false - argonOci1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonOci1ScratchDir) + argonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // For cleanup on failure var argonOci1Resources *resources.Resources @@ -548,16 +538,12 @@ func TestWCOWArgonOciV1(t *testing.T) { func TestWCOWXenonOciV1(t *testing.T) { imageLayers := testutilities.LayerFolders(t, imageName) xenonOci1Mounted := false - - xenonOci1ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonOci1ScratchDir) + xenonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), xenonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // TODO: This isn't currently used. // uvmImagePath, err := uvmfolder.LocateUVMFolder(imageLayers) @@ -605,16 +591,12 @@ func TestWCOWArgonOciV2(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) imageLayers := testutilities.LayerFolders(t, imageName) argonOci2Mounted := false - - argonOci2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(argonOci2ScratchDir) + argonOci2ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) // For cleanup on failure var argonOci2Resources *resources.Resources @@ -657,16 +639,12 @@ func TestWCOWXenonOciV2(t *testing.T) { imageLayers := testutilities.LayerFolders(t, imageName) xenonOci2Mounted := false xenonOci2UVMCreated := false - - xenonOci2ScratchDir := testutilities.CreateTempDir(t) - defer os.RemoveAll(xenonOci2ScratchDir) + xenonOci2ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), xenonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - defer os.RemoveAll(hostRWSharedDirectory) - defer os.RemoveAll(hostROSharedDirectory) uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) if err != nil { @@ -687,7 +665,7 @@ func TestWCOWXenonOciV2(t *testing.T) { // Create the utility VM. xenonOci2UVMId := "xenonOci2UVM" - xenonOci2UVMScratchDir := testutilities.CreateTempDir(t) + xenonOci2UVMScratchDir := t.TempDir() if err := wcow.CreateUVMScratch(context.Background(), uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { t.Fatalf("failed to create scratch: %s", err) } diff --git a/test/runhcs/e2e_matrix_test.go b/test/runhcs/e2e_matrix_test.go index 28c81a7746..dd7b148f58 100644 --- a/test/runhcs/e2e_matrix_test.go +++ b/test/runhcs/e2e_matrix_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package runhcs @@ -166,18 +167,15 @@ func testWindows(t *testing.T, version int, isolated bool) { var err error // Make the bundle - bundle := testutilities.CreateTempDir(t) + bundle := t.TempDir() defer func() { - if err == nil { - os.RemoveAll(bundle) - } else { + if err != nil { t.Errorf("additional logs at bundle path: %v", bundle) } }() - scratch := testutilities.CreateTempDir(t) + scratch := t.TempDir() defer func() { vhd.DetachVhd(filepath.Join(scratch, "sandbox.vhdx")) - os.RemoveAll(scratch) }() // Generate the Spec From 9ad1c07588aaef7ab98056d32a7761d1d6711830 Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Tue, 4 Jan 2022 18:20:47 -0500 Subject: [PATCH 2/5] threading client through uvm and layer path calls Signed-off-by: Hamza El-Saawy --- test/functional/lcow_test.go | 11 ++- test/functional/main_test.go | 40 +++++--- test/functional/utilities/containerd.go | 34 +++++-- test/functional/utilities/createuvm.go | 59 +++++++----- test/functional/utilities/ctrclient.go | 27 ++---- test/functional/utilities/layerfolders.go | 100 +++++--------------- test/functional/utilities/scratch.go | 2 +- test/functional/uvm.go | 24 ----- test/functional/uvm_mem_backingtype_test.go | 8 +- test/functional/uvm_memory_test.go | 7 +- test/functional/uvm_plannine_test.go | 10 +- test/functional/uvm_properties_test.go | 6 +- test/functional/uvm_scratch_test.go | 4 +- test/functional/uvm_scsi_test.go | 8 +- test/functional/uvm_virtualdevice_test.go | 5 +- test/functional/uvm_vpmem_test.go | 6 +- test/functional/uvm_vsmb_test.go | 4 +- test/functional/wcow_test.go | 19 ++-- 18 files changed, 182 insertions(+), 192 deletions(-) delete mode 100644 test/functional/uvm.go diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index bf767ea280..eb29b328ba 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -49,7 +49,8 @@ func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected string) { testutilities.RequiresBuild(t, osversion.RS5) - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + client, ctx := getCtrdClient(context.Background(), t) + lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) defer lcowUVM.Close() out, err := exec.Command(`hcsdiag`, `exec`, `-uvm`, lcowUVM.ID(), `dmesg`).Output() // TODO: Move the CreateProcess. if err != nil { @@ -107,7 +108,7 @@ func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.Preferred opts.RootFSFile = uvm.VhdFile } - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, opts) lcowUVM.Close() } } @@ -115,7 +116,9 @@ func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.Preferred func TestLCOWSimplePodScenario(t *testing.T) { t.Skip("Doesn't work quite yet") testutilities.RequiresBuild(t, osversion.RS5) - alpineLayers := testutilities.LayerFolders(t, "alpine") + client, ctx := getCtrdClient(context.Background(), t) + + alpineLayers := testutilities.LayerFolders(ctx, t, client, "alpine") cacheDir := t.TempDir() cacheFile := filepath.Join(cacheDir, "cache.vhdx") @@ -132,7 +135,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { c2ScratchDir := t.TempDir() c2ScratchFile := filepath.Join(c2ScratchDir, "sandbox.vhdx") - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "uvm")) + lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLcowUvmOptions(t, "uvm")) defer lcowUVM.Close() // Populate the cache and generate the scratch file for /tmp/scratch diff --git a/test/functional/main_test.go b/test/functional/main_test.go index f9a20a36cf..e2bc474fdb 100644 --- a/test/functional/main_test.go +++ b/test/functional/main_test.go @@ -12,6 +12,7 @@ import ( "github.com/Microsoft/hcsshim/internal/cow" "github.com/Microsoft/hcsshim/internal/hcsoci" "github.com/Microsoft/hcsshim/internal/resources" + "github.com/Microsoft/hcsshim/internal/uvm" testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" "github.com/containerd/containerd" "github.com/sirupsen/logrus" @@ -26,7 +27,7 @@ var ( pauseDurationOnCreateContainerFailure time.Duration // flags - flagContainerdEndpoint = flag.String("ctr-endpoint", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") + flagContainerdAddress = flag.String("ctr-address", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") flagContainerdNamespace = flag.String("ctr-namespace", "k8s.io", "Containerd namespace") flagCtrPath = flag.String("ctr-path", testutilities.DefaultCtrPath(), "Path to ctr.exe") flagLinuxBootFilesPath = flag.String("linux-bootfiles", @@ -65,12 +66,6 @@ func init() { func TestMain(m *testing.M) { flag.Parse() - - ctro := testutilities.GetCtrClientOptions() - ctro.Path = *flagCtrPath - ctro.Address = *flagContainerdEndpoint - ctro.Namespace = *flagContainerdNamespace - os.Exit(m.Run()) } @@ -87,20 +82,41 @@ func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptio return s, r, err } +// default options using command line flags, if any + func getCtrOptions() testutilities.CtrClientOptions { return testutilities.CtrClientOptions{ + Ctrd: getCtrdOptions(), Path: *flagLinuxBootFilesPath, - CtrdClientOptions: getCtrdOptions(), } } func getCtrdOptions() testutilities.CtrdClientOptions { return testutilities.CtrdClientOptions{ - Address: *flagContainerdEndpoint, + Address: *flagContainerdAddress, Namespace: *flagContainerdNamespace, } } -func getCtrdClient(t *testing.T) (*containerd.Client, context.Context) { - return getCtrdOptions().NewClient(context.Background(), t) -} \ No newline at end of file +func getDefaultLcowUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { + opts := uvm.NewDefaultOptionsLCOW(name, "") + opts.BootFilesPath = *flagLinuxBootFilesPath + + return opts +} + +func getDefaultWcowUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { + opts := uvm.NewDefaultOptionsWCOW(name, "") + + return opts +} + +// convenience wrappers + +func getCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { + return getCtrdOptions().NewClient(ctx, t) +} + +func pullImage(ctx context.Context, t *testing.T, snapshotter, image string) { + getCtrOptions().PullImage(ctx, t, snapshotter, image) +} diff --git a/test/functional/utilities/containerd.go b/test/functional/utilities/containerd.go index 1355e117e4..67529a3590 100644 --- a/test/functional/utilities/containerd.go +++ b/test/functional/utilities/containerd.go @@ -44,11 +44,11 @@ func (cco CtrdClientOptions) NewClient(ctx context.Context, t *testing.T, opts . } opts = append(opts, cco.defaultOpts()...) - c, err := containerd.NewWithConn(conn, opts...) + c, err := containerd.NewWithConn(conn, opts...) if err != nil { t.Fatalf("containerd.New() client failed: %v", err) } - t.Cleanup(func(){c.Close()}) + t.Cleanup(func() { c.Close() }) ctx = namespaces.WithNamespace(ctx, cco.Namespace) ctx, cancel := context.WithCancel(ctx) @@ -57,7 +57,6 @@ func (cco CtrdClientOptions) NewClient(ctx context.Context, t *testing.T, opts . return c, ctx } - func GetPlatformComparer(t *testing.T, platform string) platforms.MatchComparer { var p platforms.MatchComparer if platform == "" { @@ -92,7 +91,6 @@ func GetImageChainID(ctx context.Context, t *testing.T, client *containerd.Clien return chainID } - func CreateActiveSnapshot(ctx context.Context, t *testing.T, client *containerd.Client, snapshotter, parent, key string, opts ...snapshots.Opt) []mount.Mount { ss := client.SnapshotService(snapshotter) @@ -101,12 +99,34 @@ func CreateActiveSnapshot(ctx context.Context, t *testing.T, client *containerd. t.Fatalf("could not make active snapshot %q from %q: %v", key, parent, err) } - t.Cleanup(func(){ + t.Cleanup(func() { err = ss.Remove(ctx, key) if err != nil { - t.Fatalf("failed to remove active commit %q", key) + // remove is not idempotent, so do not Fail test + t.Logf("failed to remove active snapshot %q: %v", key, err) } }) return ms -} \ No newline at end of file +} + +// a view will not not create a new scratch layer/vhd, but instead return only the directory of the +// committed snapshot `parent` +func CreateViewSnapshot(ctx context.Context, t *testing.T, client *containerd.Client, snapshotter, parent, key string, opts ...snapshots.Opt) []mount.Mount { + ss := client.SnapshotService(snapshotter) + + ms, err := ss.View(ctx, key, parent, opts...) + if err != nil { + t.Fatalf("could not make active snapshot %q from %q: %v", key, parent, err) + } + + t.Cleanup(func() { + err = ss.Remove(ctx, key) + if err != nil { + // remove is not idempotent, so do not Fail test + t.Logf("failed to remove view snapshot %q: %v", key, err) + } + }) + + return ms +} diff --git a/test/functional/utilities/createuvm.go b/test/functional/utilities/createuvm.go index f6654f66c3..de4d00b4e1 100644 --- a/test/functional/utilities/createuvm.go +++ b/test/functional/utilities/createuvm.go @@ -2,71 +2,86 @@ package testutilities import ( "context" - "os" "testing" "github.com/Microsoft/hcsshim/internal/uvm" + "github.com/containerd/containerd" ) // CreateWCOWUVM creates a WCOW utility VM with all default options. Returns the // UtilityVM object; folder used as its scratch -func CreateWCOWUVM(ctx context.Context, t *testing.T, id, image string) (*uvm.UtilityVM, []string, string) { - return CreateWCOWUVMFromOptsWithImage(ctx, t, uvm.NewDefaultOptionsWCOW(id, ""), image) +func CreateWCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, id, image string) (*uvm.UtilityVM, []string, string) { + return CreateWCOWUVMFromOptsWithImage(ctx, t, client, uvm.NewDefaultOptionsWCOW(id, ""), image) } // CreateWCOWUVMFromOpts creates a WCOW utility VM with the passed opts. -func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, opts *uvm.OptionsWCOW) *uvm.UtilityVM { +func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Client, opts *uvm.OptionsWCOW) *uvm.UtilityVM { if opts == nil || len(opts.LayerFolders) < 2 { t.Fatalf("opts must bet set with LayerFolders") } - uvm, err := uvm.CreateWCOW(ctx, opts) + vm, err := uvm.CreateWCOW(ctx, opts) if err != nil { t.Fatal(err) } - if err := uvm.Start(ctx); err != nil { - uvm.Close() + t.Cleanup(func() { + // should be idempotent + if err := vm.Close(); err != nil { + t.Fatalf("could not close uvm %q: %v", vm.ID(), err) + } + }) + + if err := vm.Start(ctx); err != nil { + vm.Close() t.Fatal(err) } - return uvm + + return vm } // CreateWCOWUVMFromOptsWithImage creates a WCOW utility VM with the passed opts // builds the LayerFolders based on `image`. Returns the UtilityVM object; // folder used as its scratch -func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { +func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, client *containerd.Client, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { if opts == nil { t.Fatal("opts must be set") } - uvmLayers := LayerFolders(t, image) - scratchDir := t.TempDir() - - opts.LayerFolders = append(opts.LayerFolders, uvmLayers...) - opts.LayerFolders = append(opts.LayerFolders, scratchDir) + layers := LayerFolders(ctx, t, client, image) + scratch := t.TempDir() + opts.LayerFolders = append(opts.LayerFolders, layers...) + opts.LayerFolders = append(opts.LayerFolders, scratch) - return CreateWCOWUVMFromOpts(ctx, t, opts), uvmLayers, scratchDir + return CreateWCOWUVMFromOpts(ctx, t, client, opts), layers, scratch } // CreateLCOWUVM with all default options. -func CreateLCOWUVM(ctx context.Context, t *testing.T, id string) *uvm.UtilityVM { - return CreateLCOWUVMFromOpts(ctx, t, uvm.NewDefaultOptionsLCOW(id, "")) +// client is only to maintain call line compatibility with WCOW versions +func CreateLCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, id string) *uvm.UtilityVM { + return CreateLCOWUVMFromOpts(ctx, t, client, uvm.NewDefaultOptionsLCOW(id, "")) } // CreateLCOWUVMFromOpts creates an LCOW utility VM with the specified options. -func CreateLCOWUVMFromOpts(ctx context.Context, t *testing.T, opts *uvm.OptionsLCOW) *uvm.UtilityVM { +func CreateLCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Client, opts *uvm.OptionsLCOW) *uvm.UtilityVM { if opts == nil { t.Fatal("opts must be set") } - uvm, err := uvm.CreateLCOW(ctx, opts) + vm, err := uvm.CreateLCOW(ctx, opts) if err != nil { t.Fatalf("could not create LCOW UVM: %v", err) } - if err := uvm.Start(ctx); err != nil { - uvm.Close() + t.Cleanup(func() { + // should be idempotent + if err := vm.Close(); err != nil { + t.Fatalf("could not close uvm %q: %v", vm.ID(), err) + } + }) + + if err := vm.Start(ctx); err != nil { t.Fatalf("could not start LCOW UVM: %v", err) } - return uvm + + return vm } diff --git a/test/functional/utilities/ctrclient.go b/test/functional/utilities/ctrclient.go index 37accf3cb9..0892d2a86c 100644 --- a/test/functional/utilities/ctrclient.go +++ b/test/functional/utilities/ctrclient.go @@ -2,10 +2,10 @@ package testutilities import ( "context" - "fmt" "os" "os/exec" "path/filepath" + "testing" ) func DefaultCtrPath() string { @@ -18,29 +18,23 @@ func DefaultCtrPath() string { // or move `utilities/*` into parent path, similar to `tests/cri-containerd` type CtrClientOptions struct { - CtrdClientOptions - Path string + Ctrd CtrdClientOptions + Path string } -var ctro CtrClientOptions - -func GetCtrClientOptions() *CtrClientOptions { - return &ctro -} - -func (co CtrClientOptions) Command(ctx context.Context,arg ...string) *exec.Cmd { +func (co CtrClientOptions) Command(ctx context.Context, arg ...string) *exec.Cmd { args := []string{ "--address", - co.Address, + co.Ctrd.Address, "--namespace", - co.Namespace, + co.Ctrd.Namespace, } args = append(args, arg...) cmd := exec.CommandContext(ctx, co.Path, args...) return cmd } -func (co CtrClientOptions) PullImage(ctx context.Context, snapshotter, image string) error { +func (co CtrClientOptions) PullImage(ctx context.Context, t *testing.T, snapshotter, image string) { cmd := co.Command(ctx, "images", "pull", "--snapshotter", @@ -48,11 +42,6 @@ func (co CtrClientOptions) PullImage(ctx context.Context, snapshotter, image str "view", image) if err := cmd.Run(); err != nil { - return fmt.Errorf("Failed to pull image %q with %v. Command was %v", image, err, cmd) + t.Fatalf("Failed to pull image %q with %v. Command was %v", image, err, cmd) } - return nil -} - -func CtrCommand(arg ...string) *exec.Cmd { - return ctro.Command(context.Background(), arg...) } diff --git a/test/functional/utilities/layerfolders.go b/test/functional/utilities/layerfolders.go index d3a0fe0ba3..ada8e07fa6 100644 --- a/test/functional/utilities/layerfolders.go +++ b/test/functional/utilities/layerfolders.go @@ -1,110 +1,60 @@ package testutilities import ( - "bytes" + "context" "encoding/json" - "regexp" "strings" "testing" + "github.com/containerd/containerd" "github.com/containerd/containerd/mount" ) var ( imageLayers map[string][]string - chainIDRe = regexp.MustCompile(`image chain ID:\s+([a-z0-9:]+)\n`) ) func init() { imageLayers = make(map[string][]string) } -func getSnapshotterName(platform string) string { +func GetSnapshotterFromPlatform(platform string) string { if platform == PlatformWindows { return SnapshotterWindows } return SnapshotterLinux } -func LayerFolders(t *testing.T, imageName string) []string { - return LayerFoldersPlatform(t, imageName, PlatformWindows) -} - -func LayerFoldersPlatform(t *testing.T, imageName, platform string) []string { - if _, ok := imageLayers[imageName]; !ok { - imageLayers[imageName] = getLayers(t, imageName, platform) - } - return imageLayers[imageName] -} - -func getLayers(t *testing.T, imageName, platform string) []string { - var out bytes.Buffer - snapshotter := getSnapshotterName(platform) - pullCmd := CtrCommand("images", - "pull", - "--snapshotter", - snapshotter, - "view", - "--mounts", - imageName) - pullCmd.Stdout = &out - if err := pullCmd.Run(); err != nil { - t.Skipf("Failed to pull image %q with %v. Command was %v", imageName, err, pullCmd) - } - ms := chainIDRe.FindAllStringSubmatch(out.String(), -1) - if len(ms) != 1 { - t.Skipf("Failed to find chain id in output, matches are %q", ms) - } - chainID := ms[0][1] - viewName := chainID + "View" - - cmd := CtrCommand("snapshot", - "--snapshotter", - snapshotter, - "view", - "--mounts", - viewName, - chainID) - - out.Reset() - cmd.Stdout = &out - if err := cmd.Run(); err != nil { - t.Skipf("Failed to find layers for %q with %v. Command was %v", chainID, err, cmd) - } - defer removeSnapshot(t, viewName, snapshotter) - - mounts := []mount.Mount{} - if err := json.Unmarshal(out.Bytes(), &mounts); err != nil { - t.Skipf("Failed to parse layers for snapshot %q", chainID) - } - - if len(mounts) != 1 { - t.Skip("Rootfs does not contain exactly 1 mount for the root file system") - } - - // setup layer folders - m := mounts[0] - var layerFolders []string +func GetLayerFoldersFromMount(t *testing.T, m mount.Mount) (layers []string) { for _, option := range m.Options { if strings.HasPrefix(option, mount.ParentLayerPathsFlag) { - err := json.Unmarshal([]byte(option[len(mount.ParentLayerPathsFlag):]), &layerFolders) + err := json.Unmarshal([]byte(option[len(mount.ParentLayerPathsFlag):]), &layers) if err != nil { - t.Skipf("failed to unmarshal parent layer paths from mount: %v", err) + t.Fatalf("failed to unmarshal parent layer paths from mount: %v", err) } } } - layerFolders = append(layerFolders, m.Source) - return layerFolders + layers = append(layers, m.Source) + return layers } -func removeSnapshot(t *testing.T, image, snapshotter string) { - cmd := CtrCommand("snapshot", - "--snapshotter", - snapshotter, - "rm", - image) +func LayerFolders(ctx context.Context, t *testing.T, client *containerd.Client, image string) []string { + return LayerFoldersPlatform(ctx, t, client, image, PlatformWindows) +} - if err := cmd.Run(); err != nil { - t.Logf("Could not remove image %q: %v", image, err) +func LayerFoldersPlatform(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) []string { + if _, ok := imageLayers[image]; !ok { + imageLayers[image] = getLayers(ctx, t, client, image, platform) + } + return imageLayers[image] +} + +func getLayers(ctx context.Context, t *testing.T, client *containerd.Client, image, platform string) []string { + cid := GetImageChainID(ctx, t, client, image, platform) + snapshotter := GetSnapshotterFromPlatform(platform) + ms := CreateViewSnapshot(ctx, t, client, snapshotter, cid, image+"view") + if len(ms) != 1 { + t.Fatalf("Rootfs does not contain exactly 1 mount for the root file system") } + return GetLayerFoldersFromMount(t, ms[0]) } diff --git a/test/functional/utilities/scratch.go b/test/functional/utilities/scratch.go index c35d4e91db..1c775f02e9 100644 --- a/test/functional/utilities/scratch.go +++ b/test/functional/utilities/scratch.go @@ -47,7 +47,7 @@ func CreateWCOWBlankRWLayer(t *testing.T, imageLayers []string) string { // for a "service VM". func CreateLCOWBlankRWLayer(ctx context.Context, t *testing.T) string { if lcowGlobalSVM == nil { - lcowGlobalSVM = CreateLCOWUVM(ctx, t, lcowGlobalSVMID) + lcowGlobalSVM = CreateLCOWUVM(ctx, t, nil, lcowGlobalSVMID) lcowCacheScratchFile = filepath.Join(t.TempDir(), "sandbox.vhdx") } tempDir := t.TempDir() diff --git a/test/functional/uvm.go b/test/functional/uvm.go deleted file mode 100644 index 465b4b29b3..0000000000 --- a/test/functional/uvm.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build functional - -package functional - -import ( - "testing" - - "github.com/Microsoft/hcsshim/internal/uvm" -) - -// default options using command line flags, if any - -func getDefaultLcowUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { - opts := uvm.NewDefaultOptionsLCOW(name, "") - opts.BootFilesPath = *flagLinuxBootFilesPath - - return opts -} - -func getDefaultWcowUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { - opts := uvm.NewDefaultOptionsWCOW(name, "") - - return opts -} \ No newline at end of file diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index 13aca48517..e3eef7f7f3 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmmem // +build functional uvmmem package functional @@ -15,12 +16,15 @@ import ( ) func runMemStartLCOWTest(t *testing.T, opts *uvm.OptionsLCOW) { - u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, opts) + client, ctx := getCtrdClient(context.Background(), t) + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) u.Close() } func runMemStartWCOWTest(t *testing.T, opts *uvm.OptionsWCOW) { - u, _, scratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(context.Background(), t, opts, "microsoft/nanoserver") + client, ctx := getCtrdClient(context.Background(), t) + + u, _, scratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, "microsoft/nanoserver") defer os.RemoveAll(scratchDir) u.Close() } diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index bb75dc57e7..cc4672ff5c 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -18,7 +18,7 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { opts := getDefaultLcowUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, opts) + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer u.Close() newMemorySize := uint64(opts.MemorySizeInMB/2) * bytesPerMB @@ -38,13 +38,14 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { func TestUVMMemoryUpdateWCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) + client, ctx := getCtrdClient(context.Background(), t) + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) defer cancel() opts := getDefaultWcowUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, opts, "mcr.microsoft.com/windows/nanoserver:1909") + u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, "mcr.microsoft.com/windows/nanoserver:1909") defer os.RemoveAll(uvmScratchDir) defer u.Close() diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index d94bb1902a..c05b00719f 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -18,10 +18,10 @@ import ( // TestPlan9 tests adding/removing Plan9 shares to/from a v2 Linux utility VM // TODO: This is very basic. Need multiple shares and so-on. Can be iterated on later. -func TestPlan9(t *testing.T) { +func Test_Plan9(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) + vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) defer vm.Close() var iterations uint32 = 64 @@ -45,7 +45,7 @@ func TestPlan9(t *testing.T) { } func Test_Setup(t *testing.T) { - client, ctx := getCtrdClient(t) + client, ctx := getCtrdClient(context.Background(), t) is := []string{ "mcr.microsoft.com/windows/nanoserver:1903", @@ -54,8 +54,10 @@ func Test_Setup(t *testing.T) { } for _, i := range is { cid := testutilities.GetImageChainID(ctx, t, client, i, "windows") - ms := testutilities.CreateActiveSnapshot(ctx, t, client, "windows", cid, t.Name()) + ms := testutilities.CreateActiveSnapshot(ctx, t, client, "windows", cid, i+"view") t.Logf("%+v", ms) + lf := testutilities.GetLayerFoldersFromMount(t, ms[0]) + t.Logf("%+v", lf) } } diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index f9e4412260..979320fb47 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmproperties // +build functional uvmproperties package functional @@ -14,7 +15,7 @@ import ( func TestPropertiesGuestConnection_LCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) + uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) defer uvm.Close() p, gc := uvm.Capabilities() @@ -27,7 +28,8 @@ func TestPropertiesGuestConnection_LCOW(t *testing.T) { func TestPropertiesGuestConnection_WCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "microsoft/nanoserver") + client, ctx := getCtrdClient(context.Background(), t) + uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "microsoft/nanoserver") defer os.RemoveAll(uvmScratchDir) defer uvm.Close() diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index cf28292f6c..ee22e15999 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -19,7 +19,7 @@ func TestScratchCreateLCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) tempDir := t.TempDir() - firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch")) + firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch")) defer firstUVM.Close() cacheFile := filepath.Join(tempDir, "cache.vhdx") @@ -36,7 +36,7 @@ func TestScratchCreateLCOW(t *testing.T) { t.Fatalf("cacheFile wasn't created!") } - targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch_target")) + targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch_target")) defer targetUVM.Close() // A non-cached create diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index f6467696a7..b08b14e457 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -1,3 +1,4 @@ +//go:build functional || uvmscsi // +build functional uvmscsi package functional @@ -26,7 +27,7 @@ import ( // from a utility VM in both attach-only and with a container path. func TestSCSIAddRemoveLCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVM(context.Background(), t, t.Name()) + u := testutilities.CreateLCOWUVM(context.Background(), t, nil, t.Name()) defer u.Close() testSCSIAddRemoveMultiple(t, u, `/run/gcs/c/0/scsi`, "linux", []string{}) @@ -38,7 +39,8 @@ func TestSCSIAddRemoveLCOW(t *testing.T) { func TestSCSIAddRemoveWCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) // TODO make the image configurable to the build we're testing on - u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "mcr.microsoft.com/windows/nanoserver:1903") + client, ctx := getCtrdClient(context.Background(), t) + u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "mcr.microsoft.com/windows/nanoserver:1903") defer os.RemoveAll(uvmScratchDir) defer u.Close() @@ -215,7 +217,7 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string func TestParallelScsiOps(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, getDefaultLcowUvmOptions(t, t.Name())) + u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) defer u.Close() // Create a sandbox to use diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index df4403d2e6..04679ed5f0 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -6,6 +6,7 @@ package functional import ( "context" "os/exec" + "path/filepath" "strings" "testing" "time" @@ -15,7 +16,7 @@ import ( testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" ) -const lcowGPUBootFilesPath = "C:\\ContainerPlat\\LinuxBootFiles\\nvidiagpu" +var lcowGPUBootFilesPath = filepath.Join(*flagLinuxBootFilesPath, "\\nvidiagpu") // findTestDevices returns the first pcip device on the host func findTestVirtualDevice() (string, error) { @@ -54,7 +55,7 @@ func TestVirtualDevice(t *testing.T) { opts.BootFilesPath = lcowGPUBootFilesPath // create test uvm and ensure we can assign and remove the device - vm := testutilities.CreateLCOWUVMFromOpts(ctx, t, opts) + vm := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer vm.Close() vpci, err := vm.AssignDevice(ctx, testDeviceInstanceID, 0) if err != nil { diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index bafe38dbf2..4085dd36cb 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -17,10 +17,10 @@ import ( // TestVPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM func TestVPMEM(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - alpineLayers := testutilities.LayerFolders(t, "alpine") + client, ctx := getCtrdClient(context.Background(), t) + alpineLayers := testutilities.LayerFolders(ctx, t, client, "alpine") - ctx := context.Background() - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, getDefaultLcowUvmOptions(t, t.Name())) + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLcowUvmOptions(t, t.Name())) defer u.Close() var iterations uint32 = uvm.MaxVPMEMCount diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index 5ab162e5cc..2c7cd82784 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -15,7 +15,9 @@ import ( // TestVSMB tests adding/removing VSMB layers from a v2 Windows utility VM func TestVSMB(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(context.Background(), t, t.Name(), "microsoft/nanoserver") + client, ctx := getCtrdClient(context.Background(), t) + + uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "microsoft/nanoserver") defer os.RemoveAll(uvmScratchDir) defer uvm.Close() diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index 176d47261c..b86738e96a 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -363,7 +363,8 @@ func generateShimLayersStruct(t *testing.T, imageLayers []string) []hcsshim.Laye // Argon through HCSShim interface (v1) func TestWCOWArgonShim(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonShimMounted := false argonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonShimScratchDir, imageLayers); err != nil { @@ -425,7 +426,8 @@ func TestWCOWArgonShim(t *testing.T) { // Xenon through HCSShim interface (v1) func TestWCOWXenonShim(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) xenonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), xenonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) @@ -491,7 +493,8 @@ func generateWCOWOciTestSpec(t *testing.T, imageLayers []string, scratchPath, ho // Argon through HCSOCI interface (v1) func TestWCOWArgonOciV1(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonOci1Mounted := false argonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonOci1ScratchDir, imageLayers); err != nil { @@ -536,7 +539,8 @@ func TestWCOWArgonOciV1(t *testing.T) { // Xenon through HCSOCI interface (v1) func TestWCOWXenonOciV1(t *testing.T) { - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) xenonOci1Mounted := false xenonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), xenonOci1ScratchDir, imageLayers); err != nil { @@ -589,7 +593,9 @@ func TestWCOWXenonOciV1(t *testing.T) { // Argon through HCSOCI interface (v2) func TestWCOWArgonOciV2(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - imageLayers := testutilities.LayerFolders(t, imageName) + + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonOci2Mounted := false argonOci2ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(context.Background(), argonOci2ScratchDir, imageLayers); err != nil { @@ -636,7 +642,8 @@ func TestWCOWArgonOciV2(t *testing.T) { // Xenon through HCSOCI interface (v2) func TestWCOWXenonOciV2(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - imageLayers := testutilities.LayerFolders(t, imageName) + client, ctx := getCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) xenonOci2Mounted := false xenonOci2UVMCreated := false xenonOci2ScratchDir := t.TempDir() From 48e9c8073a701a7c70411bdc4c5fb0e8dbe7eedc Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Tue, 4 Jan 2022 19:37:13 -0500 Subject: [PATCH 3/5] Added test updates from Kathryb's branch Added in changes from https://github.com/microsoft/hcsshim/commit/8b80eda7465e5eaeeb794bc1e078f3cf64426b7a Signed-off-by: Hamza El-Saawy --- test/cri-containerd/runpodsandbox_test.go | 2 +- test/functional/lcow_test.go | 14 +- test/functional/main_test.go | 6 +- test/functional/utilities/constants.go | 47 ++++- test/functional/uvm_cpulimits_test.go | 49 +++++ test/functional/uvm_mem_backingtype_test.go | 13 +- test/functional/uvm_memory_test.go | 12 +- test/functional/uvm_plannine_test.go | 20 +- test/functional/uvm_properties_test.go | 10 +- test/functional/uvm_scratch_test.go | 4 +- test/functional/uvm_scsi_test.go | 6 +- test/functional/uvm_virtualdevice_test.go | 2 +- test/functional/uvm_vpmem_test.go | 10 +- test/functional/uvm_vsmb_test.go | 4 +- test/functional/wcow_test.go | 204 +++++++++++++------- 15 files changed, 272 insertions(+), 131 deletions(-) create mode 100644 test/functional/uvm_cpulimits_test.go diff --git a/test/cri-containerd/runpodsandbox_test.go b/test/cri-containerd/runpodsandbox_test.go index 6af9a5a784..e7121d9956 100644 --- a/test/cri-containerd/runpodsandbox_test.go +++ b/test/cri-containerd/runpodsandbox_test.go @@ -1064,7 +1064,7 @@ func createExt4VHD(ctx context.Context, t *testing.T, path string) { log.L.Logger.SetOutput(io.Discard) defer log.L.Logger.SetOutput(origLogOut) } - uvm := testutilities.CreateLCOWUVM(ctx, t, t.Name()+"-createExt4VHD") + uvm := testutilities.CreateLCOWUVM(ctx, t, nil, t.Name()+"-createExt4VHD") defer uvm.Close() if err := lcow.CreateScratch(ctx, uvm, path, 2, ""); err != nil { diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index eb29b328ba..e5c95e41c3 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -26,7 +26,7 @@ import ( // TestLCOWUVMNoSCSINoVPMemInitrd starts an LCOW utility VM without a SCSI controller and // no VPMem device. Uses initrd. func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { - opts := getDefaultLcowUvmOptions(t, t.Name()) + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 0 opts.PreferredRootFSType = uvm.PreferredRootFSTypeInitRd @@ -38,7 +38,7 @@ func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { // TestLCOWUVMNoSCSISingleVPMemVHD starts an LCOW utility VM without a SCSI controller and // only a single VPMem device. Uses VPMEM VHD func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { - opts := getDefaultLcowUvmOptions(t, t.Name()) + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.SCSIControllerCount = 0 opts.VPMemDeviceCount = 1 opts.PreferredRootFSType = uvm.PreferredRootFSTypeVHD @@ -49,7 +49,7 @@ func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected string) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) defer lcowUVM.Close() out, err := exec.Command(`hcsdiag`, `exec`, `-uvm`, lcowUVM.ID(), `dmesg`).Output() // TODO: Move the CreateProcess. @@ -97,7 +97,7 @@ func TestLCOWUVMStart_KernelDirect_InitRd(t *testing.T) { func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.PreferredRootFSType) { for i := 0; i < 3; i++ { - opts := getDefaultLcowUvmOptions(t, t.Name()) + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.KernelDirect = kernelDirect opts.VPMemDeviceCount = 32 opts.PreferredRootFSType = rfsType @@ -116,9 +116,9 @@ func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.Preferred func TestLCOWSimplePodScenario(t *testing.T) { t.Skip("Doesn't work quite yet") testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) - alpineLayers := testutilities.LayerFolders(ctx, t, client, "alpine") + alpineLayers := testutilities.LayerFoldersPlatform(ctx, t, client, testutilities.ImageLinuxAlpineLatest, testutilities.PlatformLinux) cacheDir := t.TempDir() cacheFile := filepath.Join(cacheDir, "cache.vhdx") @@ -135,7 +135,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { c2ScratchDir := t.TempDir() c2ScratchFile := filepath.Join(c2ScratchDir, "sandbox.vhdx") - lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLcowUvmOptions(t, "uvm")) + lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLCOWUvmOptions(t, "uvm")) defer lcowUVM.Close() // Populate the cache and generate the scratch file for /tmp/scratch diff --git a/test/functional/main_test.go b/test/functional/main_test.go index e2bc474fdb..efbd3826df 100644 --- a/test/functional/main_test.go +++ b/test/functional/main_test.go @@ -98,14 +98,14 @@ func getCtrdOptions() testutilities.CtrdClientOptions { } } -func getDefaultLcowUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { +func getDefaultLCOWUvmOptions(t *testing.T, name string) *uvm.OptionsLCOW { opts := uvm.NewDefaultOptionsLCOW(name, "") opts.BootFilesPath = *flagLinuxBootFilesPath return opts } -func getDefaultWcowUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { +func getDefaultWCOWUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { opts := uvm.NewDefaultOptionsWCOW(name, "") return opts @@ -113,7 +113,7 @@ func getDefaultWcowUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { // convenience wrappers -func getCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { +func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { return getCtrdOptions().NewClient(ctx, t) } diff --git a/test/functional/utilities/constants.go b/test/functional/utilities/constants.go index c586f467a7..8c94226aa4 100644 --- a/test/functional/utilities/constants.go +++ b/test/functional/utilities/constants.go @@ -1,6 +1,11 @@ package testutilities -import "time" +import ( + "fmt" + "time" +) + +// TODO: move these somewhere common for all tests (functional, cri-containerd, etc.) const ( connectTimeout = time.Second * 10 @@ -9,4 +14,42 @@ const ( PlatformLinux = "linux" SnapshotterWindows = "windows" SnapshotterLinux = "windows-lcow" -) \ No newline at end of file + + McrWindowsImageRepo = "mcr.microsoft.com/windows" + + ImageLinuxAlpineLatest = "docker.io/library/alpine:latest" +) + +var ( + ImageWindowsNanoserver1809 = NanoserverImage("1809") + ImageWindowsNanoserver1903 = NanoserverImage("1903") + ImageWindowsNanoserver1909 = NanoserverImage("1909") + ImageWindowsNanoserver2004 = NanoserverImage("2004") + ImageWindowsNanoserver2009 = NanoserverImage("2009") + ImageWindowsNanoserverLtsc2022 = NanoserverImage("ltsc2022") + + ImageWindowsServercore1809 = ServercoreImage("1809") + ImageWindowsServercore1903 = ServercoreImage("1903") + ImageWindowsServercore1909 = ServercoreImage("1909") + ImageWindowsServercore2004 = ServercoreImage("2004") + ImageWindowsServercore2009 = ServercoreImage("2009") + ImageWindowsServercoreLtsc2022 = ServercoreImage("ltsc2022") +) + +// all inputs should be predefined and vetted +// may not be formatted correctly for arbitrary inputs +func makeImageURL(repo, image, tag string) string { + r := fmt.Sprintf("%s/%s", repo, image) + if tag != "" { + r = fmt.Sprintf("%s:%s", r, tag) + } + return r +} + +func NanoserverImage(tag string) string { + return makeImageURL(McrWindowsImageRepo, "nanoserver", tag) +} + +func ServercoreImage(tag string) string { + return makeImageURL(McrWindowsImageRepo, "servercore", tag) +} diff --git a/test/functional/uvm_cpulimits_test.go b/test/functional/uvm_cpulimits_test.go new file mode 100644 index 0000000000..f8aab2fd49 --- /dev/null +++ b/test/functional/uvm_cpulimits_test.go @@ -0,0 +1,49 @@ +package functional + +import ( + "context" + "testing" + "time" + + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" + "github.com/Microsoft/hcsshim/osversion" + testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" +) + +func TestUVMCPULimitsUpdateLCOW(t *testing.T) { + testutilities.RequiresBuild(t, osversion.RS5) + + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + defer cancel() + + opts := getDefaultLCOWUvmOptions(t, t.Name()) + opts.MemorySizeInMB = 1024 * 2 + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) + + limits := &hcsschema.ProcessorLimits{ + Weight: 10000, + } + if err := u.UpdateCPULimits(ctx, limits); err != nil { + t.Fatalf("failed to update the cpu limits of the UVM with: %v", err) + } +} + +func TestUVMCPULimitsUpdateWCOW(t *testing.T) { + testutilities.RequiresBuild(t, osversion.RS5) + + client, ctx := newCtrdClient(context.Background(), t) + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + defer cancel() + + opts := getDefaultWCOWUvmOptions(t, t.Name()) + opts.MemorySizeInMB = 1024 * 2 + + u, _, _ := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver2004) + + limits := &hcsschema.ProcessorLimits{ + Weight: 10000, + } + if err := u.UpdateCPULimits(ctx, limits); err != nil { + t.Fatalf("failed to update the cpu limits of the UVM with: %v", err) + } +} diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index e3eef7f7f3..bd8740a5b0 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -6,7 +6,6 @@ package functional import ( "context" "io/ioutil" - "os" "testing" "github.com/Microsoft/hcsshim/internal/uvm" @@ -16,17 +15,15 @@ import ( ) func runMemStartLCOWTest(t *testing.T, opts *uvm.OptionsLCOW) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) u.Close() } func runMemStartWCOWTest(t *testing.T, opts *uvm.OptionsWCOW) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) - u, _, scratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, "microsoft/nanoserver") - defer os.RemoveAll(scratchDir) - u.Close() + testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver1809) } func runMemTests(t *testing.T, os string) { @@ -43,13 +40,13 @@ func runMemTests(t *testing.T, os string) { for _, bt := range testCases { if os == "windows" { - wopts := getDefaultWcowUvmOptions(t, t.Name()) + wopts := getDefaultWCOWUvmOptions(t, t.Name()) wopts.MemorySizeInMB = 512 wopts.AllowOvercommit = bt.allowOvercommit wopts.EnableDeferredCommit = bt.enableDeferredCommit runMemStartWCOWTest(t, wopts) } else { - lopts := getDefaultLcowUvmOptions(t, t.Name()) + lopts := getDefaultLCOWUvmOptions(t, t.Name()) lopts.MemorySizeInMB = 512 lopts.AllowOvercommit = bt.allowOvercommit lopts.EnableDeferredCommit = bt.enableDeferredCommit diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index cc4672ff5c..149ad49531 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -13,10 +13,10 @@ import ( func TestUVMMemoryUpdateLCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() - opts := getDefaultLcowUvmOptions(t, t.Name()) + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 u := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer u.Close() @@ -38,14 +38,14 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { func TestUVMMemoryUpdateWCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) - ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + client, ctx := newCtrdClient(context.Background(), t) + ctx, cancel := context.WithTimeout(ctx, 120*time.Second) defer cancel() - opts := getDefaultWcowUvmOptions(t, t.Name()) + opts := getDefaultWCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, "mcr.microsoft.com/windows/nanoserver:1909") + u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver2004) defer os.RemoveAll(uvmScratchDir) defer u.Close() diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index c05b00719f..9f99777282 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -21,7 +21,7 @@ import ( func Test_Plan9(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) + vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer vm.Close() var iterations uint32 = 64 @@ -43,21 +43,3 @@ func Test_Plan9(t *testing.T) { } } } - -func Test_Setup(t *testing.T) { - client, ctx := getCtrdClient(context.Background(), t) - - is := []string{ - "mcr.microsoft.com/windows/nanoserver:1903", - "mcr.microsoft.com/windows/nanoserver:2004", - "mcr.microsoft.com/windows/nanoserver:ltsc2022", - } - for _, i := range is { - cid := testutilities.GetImageChainID(ctx, t, client, i, "windows") - ms := testutilities.CreateActiveSnapshot(ctx, t, client, "windows", cid, i+"view") - t.Logf("%+v", ms) - lf := testutilities.GetLayerFoldersFromMount(t, ms[0]) - t.Logf("%+v", lf) - } - -} diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index 979320fb47..5737bd6acc 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -5,7 +5,6 @@ package functional import ( "context" - "os" "testing" "github.com/Microsoft/hcsshim/osversion" @@ -15,8 +14,7 @@ import ( func TestPropertiesGuestConnection_LCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) - defer uvm.Close() + uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) p, gc := uvm.Capabilities() if gc.NamespaceAddRequestSupported || @@ -28,10 +26,8 @@ func TestPropertiesGuestConnection_LCOW(t *testing.T) { func TestPropertiesGuestConnection_WCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "microsoft/nanoserver") - defer os.RemoveAll(uvmScratchDir) - defer uvm.Close() + client, ctx := newCtrdClient(context.Background(), t) + uvm, _, _ := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1809) p, gc := uvm.Capabilities() if !gc.NamespaceAddRequestSupported || diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index ee22e15999..16f71bc1d8 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -19,7 +19,7 @@ func TestScratchCreateLCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) tempDir := t.TempDir() - firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch")) + firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch")) defer firstUVM.Close() cacheFile := filepath.Join(tempDir, "cache.vhdx") @@ -36,7 +36,7 @@ func TestScratchCreateLCOW(t *testing.T) { t.Fatalf("cacheFile wasn't created!") } - targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, "TestCreateLCOWScratch_target")) + targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch_target")) defer targetUVM.Close() // A non-cached create diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index b08b14e457..d4ddea7171 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -39,8 +39,8 @@ func TestSCSIAddRemoveLCOW(t *testing.T) { func TestSCSIAddRemoveWCOW(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) // TODO make the image configurable to the build we're testing on - client, ctx := getCtrdClient(context.Background(), t) - u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "mcr.microsoft.com/windows/nanoserver:1903") + client, ctx := newCtrdClient(context.Background(), t) + u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1903) defer os.RemoveAll(uvmScratchDir) defer u.Close() @@ -217,7 +217,7 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string func TestParallelScsiOps(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLcowUvmOptions(t, t.Name())) + u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() // Create a sandbox to use diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index 04679ed5f0..5d60bcf2db 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -44,7 +44,7 @@ func TestVirtualDevice(t *testing.T) { } // update opts needed to assign a hyper-v pci device - opts := getDefaultLcowUvmOptions(t, t.Name()) + opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.VPCIEnabled = true opts.AllowOvercommit = false opts.KernelDirect = false diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index 4085dd36cb..65141f4e28 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -14,13 +14,13 @@ import ( testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" ) -// TestVPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM -func TestVPMEM(t *testing.T) { +// Test_VPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM +func Test_VPMEM(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) - alpineLayers := testutilities.LayerFolders(ctx, t, client, "alpine") + client, ctx := newCtrdClient(context.Background(), t) + alpineLayers := testutilities.LayerFoldersPlatform(ctx, t, client, testutilities.ImageLinuxAlpineLatest, testutilities.PlatformLinux) - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLcowUvmOptions(t, t.Name())) + u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() var iterations uint32 = uvm.MaxVPMEMCount diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index 2c7cd82784..fc5c6c2aab 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -15,9 +15,9 @@ import ( // TestVSMB tests adding/removing VSMB layers from a v2 Windows utility VM func TestVSMB(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), "microsoft/nanoserver") + uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1809) defer os.RemoveAll(uvmScratchDir) defer uvm.Close() diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index b86738e96a..b8e9f46abe 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -10,10 +10,13 @@ import ( "path/filepath" "strings" "testing" + "time" "github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim/internal/cow" + "github.com/Microsoft/hcsshim/internal/hcs/resourcepaths" "github.com/Microsoft/hcsshim/internal/hcs/schema1" + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" "github.com/Microsoft/hcsshim/internal/hcsoci" layerspkg "github.com/Microsoft/hcsshim/internal/layers" "github.com/Microsoft/hcsshim/internal/resources" @@ -363,11 +366,11 @@ func generateShimLayersStruct(t *testing.T, imageLayers []string) []hcsshim.Laye // Argon through HCSShim interface (v1) func TestWCOWArgonShim(t *testing.T) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonShimMounted := false argonShimScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), argonShimScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, argonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } @@ -378,13 +381,13 @@ func TestWCOWArgonShim(t *testing.T) { // For cleanup on failure defer func() { if argonShimMounted { - layerspkg.UnmountContainerLayers(context.Background(), append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll) + layerspkg.UnmountContainerLayers(ctx, append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll) } }() id := "argon" // This is a cheat but stops us re-writing exactly the same code just for test - argonShimLocalMountPath, err := layerspkg.MountContainerLayers(context.Background(), id, append(imageLayers, argonShimScratchDir), "", "", nil) + argonShimLocalMountPath, err := layerspkg.MountContainerLayers(ctx, id, append(imageLayers, argonShimScratchDir), "", "", nil) if err != nil { t.Fatal(err) } @@ -417,7 +420,7 @@ func TestWCOWArgonShim(t *testing.T) { } runShimCommands(t, argonShim) stopContainer(t, argonShim) - if err := layerspkg.UnmountContainerLayers(context.Background(), append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll); err != nil { + if err := layerspkg.UnmountContainerLayers(ctx, append(imageLayers, argonShimScratchDir), "", "", nil, layerspkg.UnmountOperationAll); err != nil { t.Fatal(err) } argonShimMounted = false @@ -426,16 +429,16 @@ func TestWCOWArgonShim(t *testing.T) { // Xenon through HCSShim interface (v1) func TestWCOWXenonShim(t *testing.T) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) xenonShimScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), xenonShimScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, xenonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) if err != nil { t.Fatalf("LocateUVMFolder failed %s", err) } @@ -472,32 +475,48 @@ func TestWCOWXenonShim(t *testing.T) { stopContainer(t, xenonShim) } -func generateWCOWOciTestSpec(t *testing.T, imageLayers []string, scratchPath, hostRWSharedDirectory, hostROSharedDirectory string) *specs.Spec { +func generateWCOWOCITestSpecGeneric(t *testing.T, imageLayers []string, scratchPath string) *specs.Spec { return &specs.Spec{ Windows: &specs.Windows{ LayerFolders: append(imageLayers, scratchPath), }, - Mounts: []specs.Mount{ - { - Source: hostROSharedDirectory, - Destination: `c:\mappedro`, - Options: []string{"ro"}, - }, - { - Source: hostRWSharedDirectory, - Destination: `c:\mappedrw`, + Process: &specs.Process{ + Args: []string{ + "cmd", + "/c", + "ping", + "-t", + "127.0.0.1", + ">", + "nul", }, }, } } +func generateWCOWOCITestSpec(t *testing.T, imageLayers []string, scratchPath, hostRWSharedDirectory, hostROSharedDirectory string) *specs.Spec { + newSpec := generateWCOWOCITestSpecGeneric(t, imageLayers, scratchPath) + newSpec.Mounts = []specs.Mount{ + { + Source: hostROSharedDirectory, + Destination: `c:\mappedro`, + Options: []string{"ro"}, + }, + { + Source: hostRWSharedDirectory, + Destination: `c:\mappedrw`, + }, + } + return newSpec +} + // Argon through HCSOCI interface (v1) func TestWCOWArgonOciV1(t *testing.T) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonOci1Mounted := false argonOci1ScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), argonOci1ScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, argonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } @@ -508,14 +527,14 @@ func TestWCOWArgonOciV1(t *testing.T) { var argonOci1 cow.Container defer func() { if argonOci1Mounted { - resources.ReleaseResources(context.Background(), argonOci1Resources, nil, true) + resources.ReleaseResources(ctx, argonOci1Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, argonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, argonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) argonOci1, argonOci1Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "argonOci1", SchemaVersion: schemaversion.SchemaV10(), @@ -525,13 +544,13 @@ func TestWCOWArgonOciV1(t *testing.T) { t.Fatal(err) } argonOci1Mounted = true - err = argonOci1.Start(context.Background()) + err = argonOci1.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, argonOci1) stopContainer(t, argonOci1) - if err := resources.ReleaseResources(context.Background(), argonOci1Resources, nil, true); err != nil { + if err := resources.ReleaseResources(ctx, argonOci1Resources, nil, true); err != nil { t.Fatal(err) } argonOci1Mounted = false @@ -539,11 +558,11 @@ func TestWCOWArgonOciV1(t *testing.T) { // Xenon through HCSOCI interface (v1) func TestWCOWXenonOciV1(t *testing.T) { - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) xenonOci1Mounted := false xenonOci1ScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), xenonOci1ScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, xenonOci1ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } @@ -560,15 +579,15 @@ func TestWCOWXenonOciV1(t *testing.T) { var xenonOci1 cow.Container defer func() { if xenonOci1Mounted { - resources.ReleaseResources(context.Background(), xenonOci1Resources, nil, true) + resources.ReleaseResources(ctx, xenonOci1Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, xenonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, xenonOci1ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) spec.Windows.HyperV = &specs.WindowsHyperV{} xenonOci1, xenonOci1Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "xenonOci1", SchemaVersion: schemaversion.SchemaV10(), @@ -578,13 +597,13 @@ func TestWCOWXenonOciV1(t *testing.T) { t.Fatal(err) } xenonOci1Mounted = true - err = xenonOci1.Start(context.Background()) + err = xenonOci1.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, xenonOci1) stopContainer(t, xenonOci1) - if err := resources.ReleaseResources(context.Background(), xenonOci1Resources, nil, true); err != nil { + if err := resources.ReleaseResources(ctx, xenonOci1Resources, nil, true); err != nil { t.Fatal(err) } xenonOci1Mounted = false @@ -594,11 +613,11 @@ func TestWCOWXenonOciV1(t *testing.T) { func TestWCOWArgonOciV2(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) + client, ctx := newCtrdClient(context.Background(), t) imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) argonOci2Mounted := false argonOci2ScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), argonOci2ScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, argonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create argon scratch layer: %s", err) } @@ -609,14 +628,14 @@ func TestWCOWArgonOciV2(t *testing.T) { var argonOci2 cow.Container defer func() { if argonOci2Mounted { - resources.ReleaseResources(context.Background(), argonOci2Resources, nil, true) + resources.ReleaseResources(ctx, argonOci2Resources, nil, true) } }() var err error - spec := generateWCOWOciTestSpec(t, imageLayers, argonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, argonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) argonOci2, argonOci2Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "argonOci2", SchemaVersion: schemaversion.SchemaV21(), @@ -626,7 +645,7 @@ func TestWCOWArgonOciV2(t *testing.T) { t.Fatal(err) } argonOci2Mounted = true - err = argonOci2.Start(context.Background()) + err = argonOci2.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } @@ -642,18 +661,16 @@ func TestWCOWArgonOciV2(t *testing.T) { // Xenon through HCSOCI interface (v2) func TestWCOWXenonOciV2(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) - client, ctx := getCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) - xenonOci2Mounted := false - xenonOci2UVMCreated := false + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, testutilities.ImageWindowsNanoserver2004) xenonOci2ScratchDir := t.TempDir() - if err := wclayer.CreateScratchLayer(context.Background(), xenonOci2ScratchDir, imageLayers); err != nil { + if err := wclayer.CreateScratchLayer(ctx, xenonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) } hostRWSharedDirectory, hostROSharedDirectory := createTestMounts(t) - uvmImagePath, err := uvmfolder.LocateUVMFolder(context.Background(), imageLayers) + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) if err != nil { t.Fatalf("LocateUVMFolder failed %s", err) } @@ -661,38 +678,29 @@ func TestWCOWXenonOciV2(t *testing.T) { var xenonOci2Resources *resources.Resources var xenonOci2 cow.Container var xenonOci2UVM *uvm.UtilityVM - defer func() { - if xenonOci2Mounted { - resources.ReleaseResources(context.Background(), xenonOci2Resources, xenonOci2UVM, true) - } - if xenonOci2UVMCreated { - xenonOci2UVM.Close() - } - }() // Create the utility VM. xenonOci2UVMId := "xenonOci2UVM" xenonOci2UVMScratchDir := t.TempDir() - if err := wcow.CreateUVMScratch(context.Background(), uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { + if err := wcow.CreateUVMScratch(ctx, uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { t.Fatalf("failed to create scratch: %s", err) } xenonOciOpts := uvm.NewDefaultOptionsWCOW(xenonOci2UVMId, "") xenonOciOpts.LayerFolders = append(imageLayers, xenonOci2UVMScratchDir) - xenonOci2UVM, err = uvm.CreateWCOW(context.Background(), xenonOciOpts) + xenonOci2UVM, err = uvm.CreateWCOW(ctx, xenonOciOpts) if err != nil { t.Fatalf("Failed create UVM: %s", err) } - xenonOci2UVMCreated = true - if err := xenonOci2UVM.Start(context.Background()); err != nil { + if err := xenonOci2UVM.Start(ctx); err != nil { xenonOci2UVM.Close() t.Fatalf("Failed start UVM: %s", err) } - spec := generateWCOWOciTestSpec(t, imageLayers, xenonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) + spec := generateWCOWOCITestSpec(t, imageLayers, xenonOci2ScratchDir, hostRWSharedDirectory, hostROSharedDirectory) xenonOci2, xenonOci2Resources, err = hcsoci.CreateContainer( - context.Background(), + ctx, &hcsoci.CreateOptions{ ID: "xenonOci2", HostingSystem: xenonOci2UVM, @@ -702,19 +710,85 @@ func TestWCOWXenonOciV2(t *testing.T) { if err != nil { t.Fatal(err) } - xenonOci2Mounted = true - err = xenonOci2.Start(context.Background()) + defer resources.ReleaseResources(ctx, xenonOci2Resources, xenonOci2UVM, true) + err = xenonOci2.Start(ctx) if err != nil { t.Fatalf("Failed start: %s", err) } runHcsCommands(t, xenonOci2) stopContainer(t, xenonOci2) - if err := resources.ReleaseResources(context.Background(), xenonOci2Resources, xenonOci2UVM, true); err != nil { +} + +// Xenon through HCSOCI interface (v2) memory update +func TestWCOWXenonOciV2MemoryUpdate(t *testing.T) { + testutilities.RequiresBuild(t, osversion.RS5) + + client, ctx := newCtrdClient(context.Background(), t) + imageLayers := testutilities.LayerFolders(ctx, t, client, testutilities.ImageWindowsNanoserver2004) + + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + defer cancel() + + xenonOci2ScratchDir := t.TempDir() + if err := wclayer.CreateScratchLayer(ctx, xenonOci2ScratchDir, imageLayers); err != nil { + t.Fatalf("failed to create xenon scratch layer: %s", err) + } + + uvmImagePath, err := uvmfolder.LocateUVMFolder(ctx, imageLayers) + if err != nil { + t.Fatalf("LocateUVMFolder failed %s", err) + } + + var xenonOci2Resources *resources.Resources + var xenonOci2 cow.Container + var xenonOci2UVM *uvm.UtilityVM + + // Create the utility VM. + xenonOci2UVMId := "xenonOci2UVM" + xenonOci2UVMScratchDir := t.TempDir() + if err := wcow.CreateUVMScratch(ctx, uvmImagePath, xenonOci2UVMScratchDir, xenonOci2UVMId); err != nil { + t.Fatalf("failed to create scratch: %s", err) + } + + xenonOciOpts := uvm.NewDefaultOptionsWCOW(xenonOci2UVMId, "") + xenonOciOpts.MemorySizeInMB = 1024 * 3 + xenonOciOpts.LayerFolders = append(imageLayers, xenonOci2UVMScratchDir) + xenonOci2UVM, err = uvm.CreateWCOW(ctx, xenonOciOpts) + if err != nil { + t.Fatalf("Failed create UVM: %s", err) + } + defer xenonOci2UVM.Close() + if err := xenonOci2UVM.Start(ctx); err != nil { + xenonOci2UVM.Close() + t.Fatalf("Failed start UVM: %s", err) + + } + + spec := generateWCOWOCITestSpecGeneric(t, imageLayers, xenonOci2ScratchDir) + spec.Annotations = make(map[string]string) + spec.Annotations["io.microsoft.virtualmachine.computetopology.memory.sizeinmb"] = "1024" + createOpts := &hcsoci.CreateOptions{ + ID: "xenonOci2", + HostingSystem: xenonOci2UVM, + SchemaVersion: schemaversion.SchemaV21(), + Spec: spec, + } + xenonOci2, xenonOci2Resources, err = hcsoci.CreateContainer(ctx, createOpts) + if err != nil { t.Fatal(err) } - xenonOci2Mounted = false + defer resources.ReleaseResources(ctx, xenonOci2Resources, xenonOci2UVM, true) - // Terminate the UVM - xenonOci2UVM.Close() - xenonOci2UVMCreated = false + if err := xenonOci2.Start(ctx); err != nil { + t.Fatalf("Failed start: %s", err) + } + + memoryLimit := hcsoci.NormalizeMemorySize(ctx, xenonOci2.ID(), uint64(1024*2)) + req := &hcsschema.ModifySettingRequest{ + ResourcePath: resourcepaths.SiloMemoryResourcePath, + Settings: memoryLimit, + } + if err := xenonOci2.Modify(ctx, req); err != nil { + t.Fatalf("Failed to update container memory size: %v", err) + } } From 9428e78af0e8e0299dc03dbb645656db0b5f1b7a Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Wed, 5 Jan 2022 16:39:50 -0500 Subject: [PATCH 4/5] Test directory restructure Moved test utilities from `test/functional/utilities` to `test/testutil` Moved manifest into new test utilities directory Moved schema test from `test/internal` into `internal/schemaversion`, and added `test/testutil/manifest` as an import dependency to get OS version. Removed internal from github actions testing Updated module paths to point to correct test folders Signed-off-by: Hamza El-Saawy --- .github/workflows/ci.yml | 2 - go.mod | 3 +- go.sum | 55 +---- internal/schemaversion/schemaversion_test.go | 63 +++++ test/cri-containerd/clone_test.go | 17 +- .../container_downlevel_test.go | 5 +- .../container_layers_packing_test.go | 9 +- test/cri-containerd/container_update_test.go | 5 +- test/cri-containerd/createcontainer_test.go | 7 +- test/cri-containerd/main_test.go | 6 +- test/cri-containerd/pod_update_test.go | 5 +- test/cri-containerd/runpodsandbox_test.go | 6 +- test/functional/lcow_test.go | 26 +- test/functional/main_test.go | 12 +- test/functional/manifest_test.go | 2 +- test/functional/uvm_cpulimits_test.go | 10 +- test/functional/uvm_mem_backingtype_test.go | 18 +- test/functional/uvm_memory_test.go | 10 +- test/functional/uvm_plannine_test.go | 8 +- test/functional/uvm_properties_test.go | 10 +- test/functional/uvm_scratch_test.go | 8 +- test/functional/uvm_scsi_test.go | 22 +- test/functional/uvm_virtualdevice_test.go | 6 +- test/functional/uvm_vpmem_test.go | 8 +- test/functional/uvm_vsmb_test.go | 6 +- test/functional/wcow_test.go | 22 +- test/go.mod | 2 +- test/go.sum | 7 +- test/internal/schemaversion_test.go | 64 ----- test/runhcs/e2e_matrix_test.go | 51 ++-- test/runhcs/runhcs_test.go | 3 +- .../utilities => testutil}/constants.go | 10 +- .../utilities => testutil}/containerd.go | 2 +- .../utilities => testutil}/createuvm.go | 34 +-- .../utilities => testutil}/ctrclient.go | 2 +- .../defaultlinuxspec.go | 2 +- .../defaultwindowsspec.go | 2 +- .../utilities => testutil}/layerfolders.go | 2 +- .../manifest/manifest.go | 0 .../manifest/rsrc_amd64.syso | Bin .../utilities => testutil}/requiresbuild.go | 2 +- .../utilities => testutil}/scratch.go | 2 +- .../utilities => testutil}/stringsetflag.go | 2 +- .../github.com/Microsoft/hcsshim/go.mod | 3 +- .../github.com/Microsoft/hcsshim/go.sum | 55 +---- .../golang.org/x/net/http/httpguts/httplex.go | 10 +- test/vendor/golang.org/x/net/http2/Dockerfile | 2 +- test/vendor/golang.org/x/net/http2/README | 20 ++ test/vendor/golang.org/x/net/http2/ascii.go | 53 ----- .../x/net/http2/client_conn_pool.go | 79 ++---- test/vendor/golang.org/x/net/http2/go115.go | 27 --- .../golang.org/x/net/http2/headermap.go | 7 +- .../golang.org/x/net/http2/not_go115.go | 31 --- test/vendor/golang.org/x/net/http2/server.go | 49 ++-- .../golang.org/x/net/http2/transport.go | 224 +++++++++--------- test/vendor/golang.org/x/net/http2/write.go | 7 +- .../golang.org/x/net/idna/idna10.0.0.go | 113 +++------ .../vendor/golang.org/x/net/idna/idna9.0.0.go | 93 +++----- .../x/text/secure/bidirule/bidirule10.0.0.go | 1 - .../x/text/secure/bidirule/bidirule9.0.0.go | 1 - .../golang.org/x/text/unicode/bidi/bidi.go | 221 +++-------------- .../golang.org/x/text/unicode/bidi/core.go | 63 ++--- .../x/text/unicode/bidi/tables10.0.0.go | 1 - .../x/text/unicode/bidi/tables11.0.0.go | 1 - .../x/text/unicode/bidi/tables12.0.0.go | 1 - .../x/text/unicode/bidi/tables13.0.0.go | 1 - .../x/text/unicode/bidi/tables9.0.0.go | 1 - .../x/text/unicode/norm/tables10.0.0.go | 1 - .../x/text/unicode/norm/tables11.0.0.go | 1 - .../x/text/unicode/norm/tables12.0.0.go | 1 - .../x/text/unicode/norm/tables13.0.0.go | 1 - .../x/text/unicode/norm/tables9.0.0.go | 1 - test/vendor/modules.txt | 6 +- .../test/testutil/manifest/manifest.go | 4 + .../test/testutil/manifest/rsrc_amd64.syso | Bin 0 -> 372470 bytes .../image-spec/specs-go/v1/index.go | 3 + .../image-spec/specs-go/v1/manifest.go | 3 + .../image-spec/specs-go/version.go | 2 +- vendor/modules.txt | 4 +- 79 files changed, 598 insertions(+), 1031 deletions(-) create mode 100644 internal/schemaversion/schemaversion_test.go delete mode 100644 test/internal/schemaversion_test.go rename test/{functional/utilities => testutil}/constants.go (79%) rename test/{functional/utilities => testutil}/containerd.go (99%) rename test/{functional/utilities => testutil}/createuvm.go (99%) rename test/{functional/utilities => testutil}/ctrclient.go (98%) rename test/{functional/utilities => testutil}/defaultlinuxspec.go (95%) rename test/{functional/utilities => testutil}/defaultwindowsspec.go (95%) rename test/{functional/utilities => testutil}/layerfolders.go (98%) rename test/{functional => testutil}/manifest/manifest.go (100%) rename test/{functional => testutil}/manifest/rsrc_amd64.syso (100%) rename test/{functional/utilities => testutil}/requiresbuild.go (93%) rename test/{functional/utilities => testutil}/scratch.go (98%) rename test/{functional/utilities => testutil}/stringsetflag.go (97%) create mode 100644 test/vendor/golang.org/x/net/http2/README delete mode 100644 test/vendor/golang.org/x/net/http2/ascii.go delete mode 100644 test/vendor/golang.org/x/net/http2/go115.go delete mode 100644 test/vendor/golang.org/x/net/http2/not_go115.go create mode 100644 vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go create mode 100644 vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0154e5961..1a9ec91e89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,8 +73,6 @@ jobs: go-version: '^1.15.0' - run: go test -gcflags=all=-d=checkptr -v ./... -tags admin - - run: go test -gcflags=all=-d=checkptr -v ./internal -tags admin - working-directory: test - run: go test -gcflags=all=-d=checkptr -c ./containerd-shim-runhcs-v1/ -tags functional working-directory: test - run: go test -gcflags=all=-d=checkptr -c ./cri-containerd/ -tags functional diff --git a/go.mod b/go.mod index 1797bd7f83..d0c21388b9 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 github.com/Microsoft/go-winio v0.4.17 + github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 github.com/cenkalti/backoff/v4 v4.1.1 github.com/containerd/cgroups v1.0.1 github.com/containerd/console v1.0.2 @@ -28,13 +29,13 @@ require ( github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.22.3 - golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e google.golang.org/grpc v1.40.0 ) replace ( + github.com/Microsoft/hcsshim/test => ./test google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 google.golang.org/grpc => google.golang.org/grpc v1.27.1 ) diff --git a/go.sum b/go.sum index afe9660c90..fce6716c99 100644 --- a/go.sum +++ b/go.sum @@ -22,9 +22,7 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= @@ -53,16 +51,15 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3 github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/Microsoft/hcsshim v0.9.1/go.mod h1:Y/0uV2jUab5kBI7SQgl62at0AVX7uaruzADAVmxm3eM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -70,22 +67,14 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -136,6 +125,8 @@ github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7 github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -225,14 +216,10 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017 h1:2HQmlpI3yI9deH18Q6xiSOIjXD4sLI55Y/gfpa8/558= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -243,11 +230,9 @@ github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avu github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -264,13 +249,11 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -300,7 +283,6 @@ github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/ github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -371,9 +353,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -400,8 +379,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -409,7 +386,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -436,7 +412,6 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -450,7 +425,6 @@ github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WT github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM= @@ -467,7 +441,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -489,15 +462,14 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -527,18 +499,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -576,8 +545,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -634,9 +601,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -708,7 +672,6 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -762,7 +725,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -839,7 +801,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -879,7 +840,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -896,7 +856,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= @@ -916,7 +875,6 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -969,7 +927,6 @@ k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NI k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= diff --git a/internal/schemaversion/schemaversion_test.go b/internal/schemaversion/schemaversion_test.go new file mode 100644 index 0000000000..3ea75db01c --- /dev/null +++ b/internal/schemaversion/schemaversion_test.go @@ -0,0 +1,63 @@ +package schemaversion + +import ( + "io/ioutil" + "testing" + + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" + "github.com/Microsoft/hcsshim/osversion" + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" + "github.com/sirupsen/logrus" +) + +func init() { + logrus.SetOutput(ioutil.Discard) +} + +func TestDetermineSchemaVersion(t *testing.T) { + osv := osversion.Get() + + if osv.Build >= osversion.RS5 { + if sv := DetermineSchemaVersion(nil); !IsV21(sv) { + t.Fatalf("expected v2") + } + if sv := DetermineSchemaVersion(SchemaV21()); !IsV21(sv) { + t.Fatalf("expected requested v2") + } + if sv := DetermineSchemaVersion(SchemaV10()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(&hcsschema.Version{}); !IsV21(sv) { + t.Fatalf("expected requested v2") + } + + if err := IsSupported(SchemaV21()); err != nil { + t.Fatalf("v2 expected to be supported") + } + if err := IsSupported(SchemaV10()); err != nil { + t.Fatalf("v1 expected to be supported") + } + + } else { + if sv := DetermineSchemaVersion(nil); !IsV10(sv) { + t.Fatalf("expected v1") + } + // Pre RS5 will downgrade to v1 even if request v2 + if sv := DetermineSchemaVersion(SchemaV21()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(SchemaV10()); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + if sv := DetermineSchemaVersion(&hcsschema.Version{}); !IsV10(sv) { + t.Fatalf("expected requested v1") + } + + if err := IsSupported(SchemaV21()); err == nil { + t.Fatalf("didn't expect v2 to be supported") + } + if err := IsSupported(SchemaV10()); err != nil { + t.Fatalf("v1 expected to be supported") + } + } +} diff --git a/test/cri-containerd/clone_test.go b/test/cri-containerd/clone_test.go index 01e675f846..e54d572024 100644 --- a/test/cri-containerd/clone_test.go +++ b/test/cri-containerd/clone_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -13,7 +14,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -239,7 +240,7 @@ func cleanupContainer(t *testing.T, client runtime.RuntimeServiceClient, ctx con // cloned container from that template. func Test_CloneContainer_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -264,7 +265,7 @@ func Test_CloneContainer_WCOW(t *testing.T) { // A test for creating multiple clones(3 clones) from one template container. func Test_MultiplClonedContainers_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -301,7 +302,7 @@ func Test_MultiplClonedContainers_WCOW(t *testing.T) { // container. func Test_NormalContainerInClonedPod_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -341,7 +342,7 @@ func Test_NormalContainerInClonedPod_WCOW(t *testing.T) { // of those pods. func Test_CloneContainersWithClonedPodPool_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -389,7 +390,7 @@ func Test_CloneContainersWithClonedPodPool_WCOW(t *testing.T) { func Test_ClonedContainerRunningAfterDeletingTemplate(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -423,7 +424,7 @@ func Test_ClonedContainerRunningAfterDeletingTemplate(t *testing.T) { // can be made from each of them simultaneously. func Test_MultipleTemplateAndClones_WCOW(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -466,7 +467,7 @@ func Test_MultipleTemplateAndClones_WCOW(t *testing.T) { // and verifies that the request correctly fails with an error. func Test_VerifyCloneAndTemplateConfig(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/test/cri-containerd/container_downlevel_test.go b/test/cri-containerd/container_downlevel_test.go index 46c618a638..d74e09fe4f 100644 --- a/test/cri-containerd/container_downlevel_test.go +++ b/test/cri-containerd/container_downlevel_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -6,13 +7,13 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) func Test_CreateContainer_DownLevel_WCOW_Hypervisor(t *testing.T) { requireFeatures(t, featureWCOWHypervisor) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredImages(t, []string{imageWindowsNanoserver17763}) diff --git a/test/cri-containerd/container_layers_packing_test.go b/test/cri-containerd/container_layers_packing_test.go index a0407f8999..57daf022df 100644 --- a/test/cri-containerd/container_layers_packing_test.go +++ b/test/cri-containerd/container_layers_packing_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -10,7 +11,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) const ( @@ -37,7 +38,7 @@ func validateTargets(ctx context.Context, t *testing.T, deviceNumber int, podID } func Test_Container_Layer_Packing_On_VPMem(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -92,7 +93,7 @@ func Test_Container_Layer_Packing_On_VPMem(t *testing.T) { } func Test_Many_Container_Layers_Supported_On_VPMem(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -123,7 +124,7 @@ func Test_Many_Container_Layers_Supported_On_VPMem(t *testing.T) { } func Test_Annotation_Disable_Multi_Mapping(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) diff --git a/test/cri-containerd/container_update_test.go b/test/cri-containerd/container_update_test.go index 0fa049d8e5..86ac807674 100644 --- a/test/cri-containerd/container_update_test.go +++ b/test/cri-containerd/container_update_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -9,7 +10,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -31,7 +32,7 @@ func calculateJobCPURate(hostProcs uint32, processorCount uint32) uint32 { } func Test_Container_UpdateResources_CPUShare(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V20H2) + testutil.RequiresBuild(t, osversion.V20H2) type config struct { name string requiredFeatures []string diff --git a/test/cri-containerd/createcontainer_test.go b/test/cri-containerd/createcontainer_test.go index aaff8fcd68..7628f5e20b 100644 --- a/test/cri-containerd/createcontainer_test.go +++ b/test/cri-containerd/createcontainer_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -13,7 +14,7 @@ import ( "github.com/Microsoft/go-winio" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -843,7 +844,7 @@ func Test_CreateContainer_CPUShares_LCOW(t *testing.T) { func Test_CreateContainer_Mount_File_LCOW(t *testing.T) { requireFeatures(t, featureLCOW) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) @@ -888,7 +889,7 @@ func Test_CreateContainer_Mount_File_LCOW(t *testing.T) { func Test_CreateContainer_Mount_ReadOnlyFile_LCOW(t *testing.T) { requireFeatures(t, featureLCOW) - testutilities.RequiresBuild(t, osversion.V19H1) + testutil.RequiresBuild(t, osversion.V19H1) pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) diff --git a/test/cri-containerd/main_test.go b/test/cri-containerd/main_test.go index 4af3204e1c..e3b091b731 100644 --- a/test/cri-containerd/main_test.go +++ b/test/cri-containerd/main_test.go @@ -14,8 +14,8 @@ import ( "time" "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/functional/manifest" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/containerd/containerd" eventtypes "github.com/containerd/containerd/api/events" eventsapi "github.com/containerd/containerd/api/services/events/v1" @@ -81,7 +81,7 @@ var ( // Flags var ( - flagFeatures = testutilities.NewStringSetFlag() + flagFeatures = testutil.NewStringSetFlag() flagCRIEndpoint = flag.String("cri-endpoint", "tcp://127.0.0.1:2376", "Address of CRI runtime and image service.") flagVirtstack = flag.String("virtstack", "", "Virtstack to use for hypervisor isolated containers") flagVMServiceBinary = flag.String("vmservice-binary", "", "Path to a binary implementing the vmservice ttrpc service") diff --git a/test/cri-containerd/pod_update_test.go b/test/cri-containerd/pod_update_test.go index 2106ae0851..9b623babff 100644 --- a/test/cri-containerd/pod_update_test.go +++ b/test/cri-containerd/pod_update_test.go @@ -1,3 +1,4 @@ +//go:build functional // +build functional package cri_containerd @@ -11,7 +12,7 @@ import ( "github.com/Microsoft/hcsshim/internal/processorinfo" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) @@ -221,7 +222,7 @@ func Test_Pod_UpdateResources_CPUShares(t *testing.T) { } func Test_Pod_UpdateResources_CPUGroup(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V21H1) + testutil.RequiresBuild(t, osversion.V21H1) ctx := context.Background() processorTopology, err := processorinfo.HostProcessorInfo(ctx) diff --git a/test/cri-containerd/runpodsandbox_test.go b/test/cri-containerd/runpodsandbox_test.go index e7121d9956..19c80f3229 100644 --- a/test/cri-containerd/runpodsandbox_test.go +++ b/test/cri-containerd/runpodsandbox_test.go @@ -24,7 +24,7 @@ import ( "github.com/Microsoft/hcsshim/internal/shimdiag" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/containerd/containerd/log" "golang.org/x/sys/windows" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" @@ -984,7 +984,7 @@ func Test_RunPodSandbox_Mount_SandboxDir_NoShare_WCOW(t *testing.T) { } func Test_RunPodSandbox_CPUGroup(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V21H1) + testutil.RequiresBuild(t, osversion.V21H1) ctx := context.Background() presentID := "FA22A12C-36B3-486D-A3E9-BC526C2B450B" @@ -1064,7 +1064,7 @@ func createExt4VHD(ctx context.Context, t *testing.T, path string) { log.L.Logger.SetOutput(io.Discard) defer log.L.Logger.SetOutput(origLogOut) } - uvm := testutilities.CreateLCOWUVM(ctx, t, nil, t.Name()+"-createExt4VHD") + uvm := testutil.CreateLCOWUVM(ctx, t, nil, t.Name()+"-createExt4VHD") defer uvm.Close() if err := lcow.CreateScratch(ctx, uvm, path, 2, ""); err != nil { diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index e5c95e41c3..a7dd96a56d 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -20,7 +20,7 @@ import ( "github.com/Microsoft/hcsshim/internal/resources" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestLCOWUVMNoSCSINoVPMemInitrd starts an LCOW utility VM without a SCSI controller and @@ -48,9 +48,9 @@ func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { } func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected string) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) + lcowUVM := testutil.CreateLCOWUVMFromOpts(ctx, t, client, opts) defer lcowUVM.Close() out, err := exec.Command(`hcsdiag`, `exec`, `-uvm`, lcowUVM.ID(), `dmesg`).Output() // TODO: Move the CreateProcess. if err != nil { @@ -64,7 +64,7 @@ func testLCOWUVMNoSCSISingleVPMem(t *testing.T, opts *uvm.OptionsLCOW, expected // TestLCOWTimeUVMStartVHD starts/terminates a utility VM booting from VPMem- // attached root filesystem a number of times. func TestLCOWTimeUVMStartVHD(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) testLCOWTimeUVMStart(t, false, uvm.PreferredRootFSTypeVHD) } @@ -73,7 +73,7 @@ func TestLCOWTimeUVMStartVHD(t *testing.T) { // VPMem- attached root filesystem a number of times starting from the Linux // Kernel directly and skipping EFI. func TestLCOWUVMStart_KernelDirect_VHD(t *testing.T) { - testutilities.RequiresBuild(t, 18286) + testutil.RequiresBuild(t, 18286) testLCOWTimeUVMStart(t, true, uvm.PreferredRootFSTypeVHD) } @@ -81,7 +81,7 @@ func TestLCOWUVMStart_KernelDirect_VHD(t *testing.T) { // TestLCOWTimeUVMStartInitRD starts/terminates a utility VM booting from initrd- // attached root file system a number of times. func TestLCOWTimeUVMStartInitRD(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) testLCOWTimeUVMStart(t, false, uvm.PreferredRootFSTypeInitRd) } @@ -90,7 +90,7 @@ func TestLCOWTimeUVMStartInitRD(t *testing.T) { // from initrd- attached root file system a number of times starting from the // Linux Kernel directly and skipping EFI. func TestLCOWUVMStart_KernelDirect_InitRd(t *testing.T) { - testutilities.RequiresBuild(t, 18286) + testutil.RequiresBuild(t, 18286) testLCOWTimeUVMStart(t, true, uvm.PreferredRootFSTypeInitRd) } @@ -108,17 +108,17 @@ func testLCOWTimeUVMStart(t *testing.T, kernelDirect bool, rfsType uvm.Preferred opts.RootFSFile = uvm.VhdFile } - lcowUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, opts) + lcowUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, opts) lcowUVM.Close() } } func TestLCOWSimplePodScenario(t *testing.T) { t.Skip("Doesn't work quite yet") - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - alpineLayers := testutilities.LayerFoldersPlatform(ctx, t, client, testutilities.ImageLinuxAlpineLatest, testutilities.PlatformLinux) + alpineLayers := testutil.LayerFoldersPlatform(ctx, t, client, testutil.ImageLinuxAlpineLatest, testutil.PlatformLinux) cacheDir := t.TempDir() cacheFile := filepath.Join(cacheDir, "cache.vhdx") @@ -135,7 +135,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { c2ScratchDir := t.TempDir() c2ScratchFile := filepath.Join(c2ScratchDir, "sandbox.vhdx") - lcowUVM := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLCOWUvmOptions(t, "uvm")) + lcowUVM := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, getDefaultLCOWUvmOptions(t, "uvm")) defer lcowUVM.Close() // Populate the cache and generate the scratch file for /tmp/scratch @@ -152,7 +152,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { if err := lcow.CreateScratch(context.Background(), lcowUVM, c1ScratchFile, lcow.DefaultScratchSizeGB, cacheFile); err != nil { t.Fatal(err) } - c1Spec := testutilities.GetDefaultLinuxSpec(t) + c1Spec := testutil.GetDefaultLinuxSpec(t) c1Folders := append(alpineLayers, c1ScratchDir) c1Spec.Windows.LayerFolders = c1Folders c1Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "one"} @@ -165,7 +165,7 @@ func TestLCOWSimplePodScenario(t *testing.T) { if err := lcow.CreateScratch(context.Background(), lcowUVM, c2ScratchFile, lcow.DefaultScratchSizeGB, cacheFile); err != nil { t.Fatal(err) } - c2Spec := testutilities.GetDefaultLinuxSpec(t) + c2Spec := testutil.GetDefaultLinuxSpec(t) c2Folders := append(alpineLayers, c2ScratchDir) c2Spec.Windows.LayerFolders = c2Folders c2Spec.Process.Args = []string{"echo", "hello", "lcow", "container", "two"} diff --git a/test/functional/main_test.go b/test/functional/main_test.go index efbd3826df..4ccf2c50d1 100644 --- a/test/functional/main_test.go +++ b/test/functional/main_test.go @@ -13,7 +13,7 @@ import ( "github.com/Microsoft/hcsshim/internal/hcsoci" "github.com/Microsoft/hcsshim/internal/resources" "github.com/Microsoft/hcsshim/internal/uvm" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/containerd/containerd" "github.com/sirupsen/logrus" ) @@ -29,7 +29,7 @@ var ( // flags flagContainerdAddress = flag.String("ctr-address", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") flagContainerdNamespace = flag.String("ctr-namespace", "k8s.io", "Containerd namespace") - flagCtrPath = flag.String("ctr-path", testutilities.DefaultCtrPath(), "Path to ctr.exe") + flagCtrPath = flag.String("ctr-path", testutil.DefaultCtrPath(), "Path to ctr.exe") flagLinuxBootFilesPath = flag.String("linux-bootfiles", "C:\\ContainerPlat\\LinuxBootFiles", "Path to LCOW UVM boot files (rootfs.vhd, initrd.img, kernel, etc.)") @@ -84,15 +84,15 @@ func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptio // default options using command line flags, if any -func getCtrOptions() testutilities.CtrClientOptions { - return testutilities.CtrClientOptions{ +func getCtrOptions() testutil.CtrClientOptions { + return testutil.CtrClientOptions{ Ctrd: getCtrdOptions(), Path: *flagLinuxBootFilesPath, } } -func getCtrdOptions() testutilities.CtrdClientOptions { - return testutilities.CtrdClientOptions{ +func getCtrdOptions() testutil.CtrdClientOptions { + return testutil.CtrdClientOptions{ Address: *flagContainerdAddress, Namespace: *flagContainerdNamespace, } diff --git a/test/functional/manifest_test.go b/test/functional/manifest_test.go index d7be25b1d2..ee199ee500 100644 --- a/test/functional/manifest_test.go +++ b/test/functional/manifest_test.go @@ -1,3 +1,3 @@ package functional -import _ "github.com/Microsoft/hcsshim/test/functional/manifest" +import _ "github.com/Microsoft/hcsshim/test/testutil/manifest" diff --git a/test/functional/uvm_cpulimits_test.go b/test/functional/uvm_cpulimits_test.go index f8aab2fd49..85580c5c88 100644 --- a/test/functional/uvm_cpulimits_test.go +++ b/test/functional/uvm_cpulimits_test.go @@ -7,18 +7,18 @@ import ( hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestUVMCPULimitsUpdateLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) limits := &hcsschema.ProcessorLimits{ Weight: 10000, @@ -29,7 +29,7 @@ func TestUVMCPULimitsUpdateLCOW(t *testing.T) { } func TestUVMCPULimitsUpdateWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) ctx, cancel := context.WithTimeout(ctx, 40*time.Second) @@ -38,7 +38,7 @@ func TestUVMCPULimitsUpdateWCOW(t *testing.T) { opts := getDefaultWCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u, _, _ := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver2004) + u, _, _ := testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver2004) limits := &hcsschema.ProcessorLimits{ Weight: 10000, diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index bd8740a5b0..ca463cf8fd 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -10,20 +10,20 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/sirupsen/logrus" ) func runMemStartLCOWTest(t *testing.T, opts *uvm.OptionsLCOW) { client, ctx := newCtrdClient(context.Background(), t) - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, opts) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, client, opts) u.Close() } func runMemStartWCOWTest(t *testing.T, opts *uvm.OptionsWCOW) { client, ctx := newCtrdClient(context.Background(), t) - testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver1809) + testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver1809) } func runMemTests(t *testing.T, os string) { @@ -56,17 +56,17 @@ func runMemTests(t *testing.T, os string) { } func TestMemBackingTypeWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) runMemTests(t, "windows") } func TestMemBackingTypeLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) runMemTests(t, "linux") } func runBenchMemStartTest(b *testing.B, opts *uvm.OptionsLCOW) { - // Cant use testutilities here because its `testing.B` not `testing.T` + // Cant use testutil here because its `testing.B` not `testing.T` u, err := uvm.CreateLCOW(context.Background(), opts) if err != nil { b.Fatal(err) @@ -88,21 +88,21 @@ func runBenchMemStartLcowTest(b *testing.B, allowOvercommit bool, enableDeferred } func BenchmarkMemBackingTypeVirtualLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, true, false) } func BenchmarkMemBackingTypeVirtualDeferredLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, true, true) } func BenchmarkMemBackingTypePhyscialLCOW(b *testing.B) { - //testutilities.RequiresBuild(t, osversion.RS5) + //testutil.RequiresBuild(t, osversion.RS5) logrus.SetOutput(ioutil.Discard) runBenchMemStartLcowTest(b, false, false) diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index 149ad49531..a4922819e0 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -7,18 +7,18 @@ import ( "time" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestUVMMemoryUpdateLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() opts := getDefaultLCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer u.Close() newMemorySize := uint64(opts.MemorySizeInMB/2) * bytesPerMB @@ -36,7 +36,7 @@ func TestUVMMemoryUpdateLCOW(t *testing.T) { } func TestUVMMemoryUpdateWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) ctx, cancel := context.WithTimeout(ctx, 120*time.Second) @@ -45,7 +45,7 @@ func TestUVMMemoryUpdateWCOW(t *testing.T) { opts := getDefaultWCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 - u, _, uvmScratchDir := testutilities.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutilities.ImageWindowsNanoserver2004) + u, _, uvmScratchDir := testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver2004) defer os.RemoveAll(uvmScratchDir) defer u.Close() diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index 9f99777282..97a122b672 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -13,15 +13,15 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestPlan9 tests adding/removing Plan9 shares to/from a v2 Linux utility VM // TODO: This is very basic. Need multiple shares and so-on. Can be iterated on later. -func Test_Plan9(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) +func TestPlan9(t *testing.T) { + testutil.RequiresBuild(t, osversion.RS5) - vm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) + vm := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer vm.Close() var iterations uint32 = 64 diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index 5737bd6acc..4137059c21 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -8,13 +8,13 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestPropertiesGuestConnection_LCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) - uvm := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) + uvm := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) p, gc := uvm.Capabilities() if gc.NamespaceAddRequestSupported || @@ -25,9 +25,9 @@ func TestPropertiesGuestConnection_LCOW(t *testing.T) { } func TestPropertiesGuestConnection_WCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - uvm, _, _ := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1809) + uvm, _, _ := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1809) p, gc := uvm.Capabilities() if !gc.NamespaceAddRequestSupported || diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index 16f71bc1d8..df8bd69f87 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -12,14 +12,14 @@ import ( "github.com/Microsoft/hcsshim/internal/lcow" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) func TestScratchCreateLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) tempDir := t.TempDir() - firstUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch")) + firstUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch")) defer firstUVM.Close() cacheFile := filepath.Join(tempDir, "cache.vhdx") @@ -36,7 +36,7 @@ func TestScratchCreateLCOW(t *testing.T) { t.Fatalf("cacheFile wasn't created!") } - targetUVM := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch_target")) + targetUVM := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, "TestCreateLCOWScratch_target")) defer targetUVM.Close() // A non-cached create diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index d4ddea7171..fd252cc9ad 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -19,15 +19,15 @@ import ( "github.com/Microsoft/hcsshim/internal/lcow" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" "github.com/sirupsen/logrus" ) // TestSCSIAddRemovev2LCOW validates adding and removing SCSI disks // from a utility VM in both attach-only and with a container path. func TestSCSIAddRemoveLCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVM(context.Background(), t, nil, t.Name()) + testutil.RequiresBuild(t, osversion.RS5) + u := testutil.CreateLCOWUVM(context.Background(), t, nil, t.Name()) defer u.Close() testSCSIAddRemoveMultiple(t, u, `/run/gcs/c/0/scsi`, "linux", []string{}) @@ -37,10 +37,10 @@ func TestSCSIAddRemoveLCOW(t *testing.T) { // TestSCSIAddRemoveWCOW validates adding and removing SCSI disks // from a utility VM in both attach-only and with a container path. func TestSCSIAddRemoveWCOW(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) // TODO make the image configurable to the build we're testing on client, ctx := newCtrdClient(context.Background(), t) - u, layers, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1903) + u, layers, uvmScratchDir := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1903) defer os.RemoveAll(uvmScratchDir) defer u.Close() @@ -87,9 +87,9 @@ func testSCSIAddRemoveSingle(t *testing.T, u *uvm.UtilityVM, pathPrefix string, for i := 0; i < numDisks; i++ { tempDir := "" if operatingSystem == "windows" { - tempDir = testutilities.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) + tempDir = testutil.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) } else { - tempDir = testutilities.CreateLCOWBlankRWLayer(context.Background(), t) + tempDir = testutil.CreateLCOWBlankRWLayer(context.Background(), t) } defer os.RemoveAll(tempDir) disks[i] = filepath.Join(tempDir, `sandbox.vhdx`) @@ -138,9 +138,9 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string for i := 0; i < numDisks; i++ { tempDir := "" if operatingSystem == "windows" { - tempDir = testutilities.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) + tempDir = testutil.CreateWCOWBlankRWLayer(t, wcowImageLayerFolders) } else { - tempDir = testutilities.CreateLCOWBlankRWLayer(context.Background(), t) + tempDir = testutil.CreateLCOWBlankRWLayer(context.Background(), t) } defer os.RemoveAll(tempDir) disks[i] = filepath.Join(tempDir, `sandbox.vhdx`) @@ -216,8 +216,8 @@ func testSCSIAddRemoveMultiple(t *testing.T, u *uvm.UtilityVM, pathPrefix string } func TestParallelScsiOps(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) - u := testutilities.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) + testutil.RequiresBuild(t, osversion.RS5) + u := testutil.CreateLCOWUVMFromOpts(context.Background(), t, nil, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() // Create a sandbox to use diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index 5d60bcf2db..303137bbf9 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -13,7 +13,7 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) var lcowGPUBootFilesPath = filepath.Join(*flagLinuxBootFilesPath, "\\nvidiagpu") @@ -31,7 +31,7 @@ func findTestVirtualDevice() (string, error) { } func TestVirtualDevice(t *testing.T) { - testutilities.RequiresBuild(t, osversion.V20H1) + testutil.RequiresBuild(t, osversion.V20H1) ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() @@ -55,7 +55,7 @@ func TestVirtualDevice(t *testing.T) { opts.BootFilesPath = lcowGPUBootFilesPath // create test uvm and ensure we can assign and remove the device - vm := testutilities.CreateLCOWUVMFromOpts(ctx, t, nil, opts) + vm := testutil.CreateLCOWUVMFromOpts(ctx, t, nil, opts) defer vm.Close() vpci, err := vm.AssignDevice(ctx, testDeviceInstanceID, 0) if err != nil { diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index 65141f4e28..19eeb5bd89 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -11,16 +11,16 @@ import ( "github.com/Microsoft/hcsshim/internal/copyfile" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // Test_VPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM func Test_VPMEM(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - alpineLayers := testutilities.LayerFoldersPlatform(ctx, t, client, testutilities.ImageLinuxAlpineLatest, testutilities.PlatformLinux) + alpineLayers := testutil.LayerFoldersPlatform(ctx, t, client, testutil.ImageLinuxAlpineLatest, testutil.PlatformLinux) - u := testutilities.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLCOWUvmOptions(t, t.Name())) + u := testutil.CreateLCOWUVMFromOpts(ctx, t, client, getDefaultLCOWUvmOptions(t, t.Name())) defer u.Close() var iterations uint32 = uvm.MaxVPMEMCount diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index fc5c6c2aab..20483c6bad 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -9,15 +9,15 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" ) // TestVSMB tests adding/removing VSMB layers from a v2 Windows utility VM func TestVSMB(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - uvm, _, uvmScratchDir := testutilities.CreateWCOWUVM(ctx, t, client, t.Name(), testutilities.ImageWindowsNanoserver1809) + uvm, _, uvmScratchDir := testutil.CreateWCOWUVM(ctx, t, client, t.Name(), testutil.ImageWindowsNanoserver1809) defer os.RemoveAll(uvmScratchDir) defer uvm.Close() diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index b8e9f46abe..9fb5805276 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -26,7 +26,7 @@ import ( "github.com/Microsoft/hcsshim/internal/wclayer" "github.com/Microsoft/hcsshim/internal/wcow" "github.com/Microsoft/hcsshim/osversion" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" specs "github.com/opencontainers/runtime-spec/specs-go" ) @@ -367,7 +367,7 @@ func generateShimLayersStruct(t *testing.T, imageLayers []string) []hcsshim.Laye // Argon through HCSShim interface (v1) func TestWCOWArgonShim(t *testing.T) { client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) argonShimMounted := false argonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, argonShimScratchDir, imageLayers); err != nil { @@ -430,7 +430,7 @@ func TestWCOWArgonShim(t *testing.T) { // Xenon through HCSShim interface (v1) func TestWCOWXenonShim(t *testing.T) { client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) xenonShimScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, xenonShimScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) @@ -513,7 +513,7 @@ func generateWCOWOCITestSpec(t *testing.T, imageLayers []string, scratchPath, ho // Argon through HCSOCI interface (v1) func TestWCOWArgonOciV1(t *testing.T) { client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) argonOci1Mounted := false argonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, argonOci1ScratchDir, imageLayers); err != nil { @@ -559,7 +559,7 @@ func TestWCOWArgonOciV1(t *testing.T) { // Xenon through HCSOCI interface (v1) func TestWCOWXenonOciV1(t *testing.T) { client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) xenonOci1Mounted := false xenonOci1ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, xenonOci1ScratchDir, imageLayers); err != nil { @@ -611,10 +611,10 @@ func TestWCOWXenonOciV1(t *testing.T) { // Argon through HCSOCI interface (v2) func TestWCOWArgonOciV2(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, imageName) + imageLayers := testutil.LayerFolders(ctx, t, client, imageName) argonOci2Mounted := false argonOci2ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, argonOci2ScratchDir, imageLayers); err != nil { @@ -660,9 +660,9 @@ func TestWCOWArgonOciV2(t *testing.T) { // Xenon through HCSOCI interface (v2) func TestWCOWXenonOciV2(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, testutilities.ImageWindowsNanoserver2004) + imageLayers := testutil.LayerFolders(ctx, t, client, testutil.ImageWindowsNanoserver2004) xenonOci2ScratchDir := t.TempDir() if err := wclayer.CreateScratchLayer(ctx, xenonOci2ScratchDir, imageLayers); err != nil { t.Fatalf("failed to create xenon scratch layer: %s", err) @@ -721,10 +721,10 @@ func TestWCOWXenonOciV2(t *testing.T) { // Xenon through HCSOCI interface (v2) memory update func TestWCOWXenonOciV2MemoryUpdate(t *testing.T) { - testutilities.RequiresBuild(t, osversion.RS5) + testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - imageLayers := testutilities.LayerFolders(ctx, t, client, testutilities.ImageWindowsNanoserver2004) + imageLayers := testutil.LayerFolders(ctx, t, client, testutil.ImageWindowsNanoserver2004) ctx, cancel := context.WithTimeout(ctx, 40*time.Second) defer cancel() diff --git a/test/go.mod b/test/go.mod index 6c668abfbf..5976197a95 100644 --- a/test/go.mod +++ b/test/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/Microsoft/go-winio v0.4.17 - github.com/Microsoft/hcsshim v0.8.23 + github.com/Microsoft/hcsshim v0.9.1 github.com/containerd/containerd v1.5.8 github.com/containerd/go-runc v1.0.0 github.com/containerd/ttrpc v1.1.0 diff --git a/test/go.sum b/test/go.sum index f5805153e2..c4630d61fe 100644 --- a/test/go.sum +++ b/test/go.sum @@ -696,9 +696,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -775,7 +774,6 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= @@ -786,9 +784,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/test/internal/schemaversion_test.go b/test/internal/schemaversion_test.go deleted file mode 100644 index cb7ecf241a..0000000000 --- a/test/internal/schemaversion_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package internal - -import ( - "io/ioutil" - "testing" - - hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" - "github.com/Microsoft/hcsshim/internal/schemaversion" - "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/functional/manifest" - "github.com/sirupsen/logrus" -) - -func init() { - logrus.SetOutput(ioutil.Discard) -} - -func TestDetermineSchemaVersion(t *testing.T) { - osv := osversion.Get() - - if osv.Build >= osversion.RS5 { - if sv := schemaversion.DetermineSchemaVersion(nil); !schemaversion.IsV21(sv) { - t.Fatalf("expected v2") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV21()); !schemaversion.IsV21(sv) { - t.Fatalf("expected requested v2") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV10()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(&hcsschema.Version{}); !schemaversion.IsV21(sv) { - t.Fatalf("expected requested v2") - } - - if err := schemaversion.IsSupported(schemaversion.SchemaV21()); err != nil { - t.Fatalf("v2 expected to be supported") - } - if err := schemaversion.IsSupported(schemaversion.SchemaV10()); err != nil { - t.Fatalf("v1 expected to be supported") - } - - } else { - if sv := schemaversion.DetermineSchemaVersion(nil); !schemaversion.IsV10(sv) { - t.Fatalf("expected v1") - } - // Pre RS5 will downgrade to v1 even if request v2 - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV21()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(schemaversion.SchemaV10()); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - if sv := schemaversion.DetermineSchemaVersion(&hcsschema.Version{}); !schemaversion.IsV10(sv) { - t.Fatalf("expected requested v1") - } - - if err := schemaversion.IsSupported(schemaversion.SchemaV21()); err == nil { - t.Fatalf("didn't expect v2 to be supported") - } - if err := schemaversion.IsSupported(schemaversion.SchemaV10()); err != nil { - t.Fatalf("v1 expected to be supported") - } - } -} diff --git a/test/runhcs/e2e_matrix_test.go b/test/runhcs/e2e_matrix_test.go index dd7b148f58..d2ed8acbba 100644 --- a/test/runhcs/e2e_matrix_test.go +++ b/test/runhcs/e2e_matrix_test.go @@ -19,7 +19,8 @@ import ( "github.com/Microsoft/go-winio/vhd" "github.com/Microsoft/hcsshim/osversion" runhcs "github.com/Microsoft/hcsshim/pkg/go-runhcs" - testutilities "github.com/Microsoft/hcsshim/test/functional/utilities" + "github.com/Microsoft/hcsshim/test/testutil" + "github.com/containerd/containerd" runc "github.com/containerd/go-runc" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" @@ -163,6 +164,26 @@ func readPidFile(path string) (int, error) { return p, nil } +func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { + cdo := testutil.CtrdClientOptions{ + Address: "tcp://127.0.0.1:2376", + Namespace: "k8s.io", + } + + return cdo.NewClient(ctx, t) +} + +func pullImage(ctx context.Context, t *testing.T, snapshotter, image string) { + co := testutil.CtrClientOptions{ + Ctrd: testutil.CtrdClientOptions{ + Address: "tcp://127.0.0.1:2376", + Namespace: "k8s.io", + }, + Path: filepath.Join(filepath.Dir(os.Args[0]), "ctr.exe"), + } + co.PullImage(ctx, t, snapshotter, image) +} + func testWindows(t *testing.T, version int, isolated bool) { var err error @@ -192,7 +213,8 @@ func testWindows(t *testing.T, version int, isolated bool) { // Get the LayerFolders imageName := getWindowsImageNameByVersion(t, version) - layers := testutilities.LayerFolders(t, imageName) + client, ctx := newCtrdClient(context.Background(), t) + layers := testutil.LayerFolders(ctx, t, client, imageName) for _, layer := range layers { g.AddWindowsLayerFolders(layer) } @@ -212,7 +234,6 @@ func testWindows(t *testing.T, version int, isolated bool) { cf.Close() // Create the Argon, Xenon, or UVM - ctx := context.TODO() rhcs := runhcs.Runhcs{ Debug: true, } @@ -308,25 +329,25 @@ func testLCOWPod(t *testing.T) { } func Test_RS1_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS1) + testutil.RequiresExactBuild(t, osversion.RS1) testWindows(t, osversion.RS1, false) } func Test_RS1_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS1) + testutil.RequiresExactBuild(t, osversion.RS1) testWindows(t, osversion.RS1, true) } func Test_RS3_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS3) + testutil.RequiresExactBuild(t, osversion.RS3) testWindows(t, osversion.RS3, false) } func Test_RS3_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS3) + testutil.RequiresExactBuild(t, osversion.RS3) guests := []int{osversion.RS1, osversion.RS3} for _, g := range guests { @@ -335,13 +356,13 @@ func Test_RS3_Xenon(t *testing.T) { } func Test_RS4_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS4) + testutil.RequiresExactBuild(t, osversion.RS4) testWindows(t, osversion.RS4, false) } func Test_RS4_Xenon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS4) + testutil.RequiresExactBuild(t, osversion.RS4) guests := []int{osversion.RS1, osversion.RS3, osversion.RS4} for _, g := range guests { @@ -350,19 +371,19 @@ func Test_RS4_Xenon(t *testing.T) { } func Test_RS5_Argon(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindows(t, osversion.RS5, false) } func Test_RS5_ArgonPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindowsPod(t, osversion.RS5, false) } func Test_RS5_UVMAndContainer(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) guests := []int{osversion.RS1, osversion.RS3, osversion.RS4, osversion.RS5} for _, g := range guests { @@ -371,19 +392,19 @@ func Test_RS5_UVMAndContainer(t *testing.T) { } func Test_RS5_UVMPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testWindowsPod(t, osversion.RS5, true) } func Test_RS5_LCOW(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testLCOW(t) } func Test_RS5_LCOW_UVMPods(t *testing.T) { - testutilities.RequiresExactBuild(t, osversion.RS5) + testutil.RequiresExactBuild(t, osversion.RS5) testLCOWPod(t) } diff --git a/test/runhcs/runhcs_test.go b/test/runhcs/runhcs_test.go index 427c3d1ec2..2906711e01 100644 --- a/test/runhcs/runhcs_test.go +++ b/test/runhcs/runhcs_test.go @@ -1,7 +1,8 @@ +//go:build functional // +build functional package runhcs import ( - _ "github.com/Microsoft/hcsshim/test/functional/manifest" + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" ) diff --git a/test/functional/utilities/constants.go b/test/testutil/constants.go similarity index 79% rename from test/functional/utilities/constants.go rename to test/testutil/constants.go index 8c94226aa4..a33d5c2da3 100644 --- a/test/functional/utilities/constants.go +++ b/test/testutil/constants.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "fmt" @@ -21,19 +21,23 @@ const ( ) var ( + ImageWindowsNanoserver1709 = NanoserverImage("1709") + ImageWindowsNanoserver1803 = NanoserverImage("1803") ImageWindowsNanoserver1809 = NanoserverImage("1809") ImageWindowsNanoserver1903 = NanoserverImage("1903") ImageWindowsNanoserver1909 = NanoserverImage("1909") ImageWindowsNanoserver2004 = NanoserverImage("2004") ImageWindowsNanoserver2009 = NanoserverImage("2009") - ImageWindowsNanoserverLtsc2022 = NanoserverImage("ltsc2022") + ImageWindowsNanoserverLTSC2022 = NanoserverImage("ltsc2022") + ImageWindowsServercore1709 = NanoserverImage("1709") + ImageWindowsServercore1803 = NanoserverImage("1803") ImageWindowsServercore1809 = ServercoreImage("1809") ImageWindowsServercore1903 = ServercoreImage("1903") ImageWindowsServercore1909 = ServercoreImage("1909") ImageWindowsServercore2004 = ServercoreImage("2004") ImageWindowsServercore2009 = ServercoreImage("2009") - ImageWindowsServercoreLtsc2022 = ServercoreImage("ltsc2022") + ImageWindowsServercoreLTSC2022 = ServercoreImage("ltsc2022") ) // all inputs should be predefined and vetted diff --git a/test/functional/utilities/containerd.go b/test/testutil/containerd.go similarity index 99% rename from test/functional/utilities/containerd.go rename to test/testutil/containerd.go index 67529a3590..bf9e8f4ede 100644 --- a/test/functional/utilities/containerd.go +++ b/test/testutil/containerd.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" diff --git a/test/functional/utilities/createuvm.go b/test/testutil/createuvm.go similarity index 99% rename from test/functional/utilities/createuvm.go rename to test/testutil/createuvm.go index de4d00b4e1..2d50021eac 100644 --- a/test/functional/utilities/createuvm.go +++ b/test/testutil/createuvm.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" @@ -15,6 +15,22 @@ func CreateWCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, } +// CreateWCOWUVMFromOptsWithImage creates a WCOW utility VM with the passed opts +// builds the LayerFolders based on `image`. Returns the UtilityVM object; +// folder used as its scratch +func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, client *containerd.Client, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { + if opts == nil { + t.Fatal("opts must be set") + } + + layers := LayerFolders(ctx, t, client, image) + scratch := t.TempDir() + opts.LayerFolders = append(opts.LayerFolders, layers...) + opts.LayerFolders = append(opts.LayerFolders, scratch) + + return CreateWCOWUVMFromOpts(ctx, t, client, opts), layers, scratch +} + // CreateWCOWUVMFromOpts creates a WCOW utility VM with the passed opts. func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Client, opts *uvm.OptionsWCOW) *uvm.UtilityVM { if opts == nil || len(opts.LayerFolders) < 2 { @@ -40,22 +56,6 @@ func CreateWCOWUVMFromOpts(ctx context.Context, t *testing.T, _ *containerd.Clie return vm } -// CreateWCOWUVMFromOptsWithImage creates a WCOW utility VM with the passed opts -// builds the LayerFolders based on `image`. Returns the UtilityVM object; -// folder used as its scratch -func CreateWCOWUVMFromOptsWithImage(ctx context.Context, t *testing.T, client *containerd.Client, opts *uvm.OptionsWCOW, image string) (*uvm.UtilityVM, []string, string) { - if opts == nil { - t.Fatal("opts must be set") - } - - layers := LayerFolders(ctx, t, client, image) - scratch := t.TempDir() - opts.LayerFolders = append(opts.LayerFolders, layers...) - opts.LayerFolders = append(opts.LayerFolders, scratch) - - return CreateWCOWUVMFromOpts(ctx, t, client, opts), layers, scratch -} - // CreateLCOWUVM with all default options. // client is only to maintain call line compatibility with WCOW versions func CreateLCOWUVM(ctx context.Context, t *testing.T, client *containerd.Client, id string) *uvm.UtilityVM { diff --git a/test/functional/utilities/ctrclient.go b/test/testutil/ctrclient.go similarity index 98% rename from test/functional/utilities/ctrclient.go rename to test/testutil/ctrclient.go index 0892d2a86c..ddf4e358b8 100644 --- a/test/functional/utilities/ctrclient.go +++ b/test/testutil/ctrclient.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" diff --git a/test/functional/utilities/defaultlinuxspec.go b/test/testutil/defaultlinuxspec.go similarity index 95% rename from test/functional/utilities/defaultlinuxspec.go rename to test/testutil/defaultlinuxspec.go index 2f0b019799..59b6302e79 100644 --- a/test/functional/utilities/defaultlinuxspec.go +++ b/test/testutil/defaultlinuxspec.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "encoding/json" diff --git a/test/functional/utilities/defaultwindowsspec.go b/test/testutil/defaultwindowsspec.go similarity index 95% rename from test/functional/utilities/defaultwindowsspec.go rename to test/testutil/defaultwindowsspec.go index e1fa541a54..a691a03829 100644 --- a/test/functional/utilities/defaultwindowsspec.go +++ b/test/testutil/defaultwindowsspec.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "encoding/json" diff --git a/test/functional/utilities/layerfolders.go b/test/testutil/layerfolders.go similarity index 98% rename from test/functional/utilities/layerfolders.go rename to test/testutil/layerfolders.go index ada8e07fa6..b2f9bb5652 100644 --- a/test/functional/utilities/layerfolders.go +++ b/test/testutil/layerfolders.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" diff --git a/test/functional/manifest/manifest.go b/test/testutil/manifest/manifest.go similarity index 100% rename from test/functional/manifest/manifest.go rename to test/testutil/manifest/manifest.go diff --git a/test/functional/manifest/rsrc_amd64.syso b/test/testutil/manifest/rsrc_amd64.syso similarity index 100% rename from test/functional/manifest/rsrc_amd64.syso rename to test/testutil/manifest/rsrc_amd64.syso diff --git a/test/functional/utilities/requiresbuild.go b/test/testutil/requiresbuild.go similarity index 93% rename from test/functional/utilities/requiresbuild.go rename to test/testutil/requiresbuild.go index 47930994d0..33a13bb568 100644 --- a/test/functional/utilities/requiresbuild.go +++ b/test/testutil/requiresbuild.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "testing" diff --git a/test/functional/utilities/scratch.go b/test/testutil/scratch.go similarity index 98% rename from test/functional/utilities/scratch.go rename to test/testutil/scratch.go index 1c775f02e9..f1cc685895 100644 --- a/test/functional/utilities/scratch.go +++ b/test/testutil/scratch.go @@ -1,4 +1,4 @@ -package testutilities +package testutil import ( "context" diff --git a/test/functional/utilities/stringsetflag.go b/test/testutil/stringsetflag.go similarity index 97% rename from test/functional/utilities/stringsetflag.go rename to test/testutil/stringsetflag.go index eeb06bf4cf..bbc16a86da 100644 --- a/test/functional/utilities/stringsetflag.go +++ b/test/testutil/stringsetflag.go @@ -1,4 +1,4 @@ -package testutilities +package testutil // StringSetFlag is a type to be used with the standard library's flag.Var // function as a custom flag value. It accumulates the arguments passed each diff --git a/test/vendor/github.com/Microsoft/hcsshim/go.mod b/test/vendor/github.com/Microsoft/hcsshim/go.mod index 1797bd7f83..d0c21388b9 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/go.mod +++ b/test/vendor/github.com/Microsoft/hcsshim/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 github.com/Microsoft/go-winio v0.4.17 + github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 github.com/cenkalti/backoff/v4 v4.1.1 github.com/containerd/cgroups v1.0.1 github.com/containerd/console v1.0.2 @@ -28,13 +29,13 @@ require ( github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae go.etcd.io/bbolt v1.3.6 go.opencensus.io v0.22.3 - golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e google.golang.org/grpc v1.40.0 ) replace ( + github.com/Microsoft/hcsshim/test => ./test google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 google.golang.org/grpc => google.golang.org/grpc v1.27.1 ) diff --git a/test/vendor/github.com/Microsoft/hcsshim/go.sum b/test/vendor/github.com/Microsoft/hcsshim/go.sum index afe9660c90..fce6716c99 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/go.sum +++ b/test/vendor/github.com/Microsoft/hcsshim/go.sum @@ -22,9 +22,7 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= @@ -53,16 +51,15 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3 github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/Microsoft/hcsshim v0.9.1/go.mod h1:Y/0uV2jUab5kBI7SQgl62at0AVX7uaruzADAVmxm3eM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -70,22 +67,14 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -136,6 +125,8 @@ github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7 github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -225,14 +216,10 @@ github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjI github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017 h1:2HQmlpI3yI9deH18Q6xiSOIjXD4sLI55Y/gfpa8/558= github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -243,11 +230,9 @@ github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avu github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -264,13 +249,11 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -300,7 +283,6 @@ github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/ github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -371,9 +353,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -400,8 +379,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -409,7 +386,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -436,7 +412,6 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -450,7 +425,6 @@ github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WT github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM= @@ -467,7 +441,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -489,15 +462,14 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -527,18 +499,15 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -576,8 +545,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -634,9 +601,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -708,7 +672,6 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -762,7 +725,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -839,7 +801,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -879,7 +840,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -896,7 +856,6 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= @@ -916,7 +875,6 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= @@ -969,7 +927,6 @@ k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NI k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= diff --git a/test/vendor/golang.org/x/net/http/httpguts/httplex.go b/test/vendor/golang.org/x/net/http/httpguts/httplex.go index c79aa73f28..e7de24ee64 100644 --- a/test/vendor/golang.org/x/net/http/httpguts/httplex.go +++ b/test/vendor/golang.org/x/net/http/httpguts/httplex.go @@ -137,13 +137,11 @@ func trimOWS(x string) string { // contains token amongst its comma-separated tokens, ASCII // case-insensitively. func headerValueContainsToken(v string, token string) bool { - for comma := strings.IndexByte(v, ','); comma != -1; comma = strings.IndexByte(v, ',') { - if tokenEqual(trimOWS(v[:comma]), token) { - return true - } - v = v[comma+1:] + v = trimOWS(v) + if comma := strings.IndexByte(v, ','); comma != -1 { + return tokenEqual(trimOWS(v[:comma]), token) || headerValueContainsToken(v[comma+1:], token) } - return tokenEqual(trimOWS(v), token) + return tokenEqual(v, token) } // lowerASCII returns the ASCII lowercase version of b. diff --git a/test/vendor/golang.org/x/net/http2/Dockerfile b/test/vendor/golang.org/x/net/http2/Dockerfile index 8512245952..53fc525797 100644 --- a/test/vendor/golang.org/x/net/http2/Dockerfile +++ b/test/vendor/golang.org/x/net/http2/Dockerfile @@ -38,7 +38,7 @@ RUN make RUN make install WORKDIR /root -RUN wget https://curl.se/download/curl-7.45.0.tar.gz +RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz RUN tar -zxvf curl-7.45.0.tar.gz WORKDIR /root/curl-7.45.0 RUN ./configure --with-ssl --with-nghttp2=/usr/local diff --git a/test/vendor/golang.org/x/net/http2/README b/test/vendor/golang.org/x/net/http2/README new file mode 100644 index 0000000000..360d5aa379 --- /dev/null +++ b/test/vendor/golang.org/x/net/http2/README @@ -0,0 +1,20 @@ +This is a work-in-progress HTTP/2 implementation for Go. + +It will eventually live in the Go standard library and won't require +any changes to your code to use. It will just be automatic. + +Status: + +* The server support is pretty good. A few things are missing + but are being worked on. +* The client work has just started but shares a lot of code + is coming along much quicker. + +Docs are at https://godoc.org/golang.org/x/net/http2 + +Demo test server at https://http2.golang.org/ + +Help & bug reports welcome! + +Contributing: https://golang.org/doc/contribute.html +Bugs: https://golang.org/issue/new?title=x/net/http2:+ diff --git a/test/vendor/golang.org/x/net/http2/ascii.go b/test/vendor/golang.org/x/net/http2/ascii.go deleted file mode 100644 index 17caa20586..0000000000 --- a/test/vendor/golang.org/x/net/http2/ascii.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import "strings" - -// The HTTP protocols are defined in terms of ASCII, not Unicode. This file -// contains helper functions which may use Unicode-aware functions which would -// otherwise be unsafe and could introduce vulnerabilities if used improperly. - -// asciiEqualFold is strings.EqualFold, ASCII only. It reports whether s and t -// are equal, ASCII-case-insensitively. -func asciiEqualFold(s, t string) bool { - if len(s) != len(t) { - return false - } - for i := 0; i < len(s); i++ { - if lower(s[i]) != lower(t[i]) { - return false - } - } - return true -} - -// lower returns the ASCII lowercase version of b. -func lower(b byte) byte { - if 'A' <= b && b <= 'Z' { - return b + ('a' - 'A') - } - return b -} - -// isASCIIPrint returns whether s is ASCII and printable according to -// https://tools.ietf.org/html/rfc20#section-4.2. -func isASCIIPrint(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] < ' ' || s[i] > '~' { - return false - } - } - return true -} - -// asciiToLower returns the lowercase version of s if s is ASCII and printable, -// and whether or not it was. -func asciiToLower(s string) (lower string, ok bool) { - if !isASCIIPrint(s) { - return "", false - } - return strings.ToLower(s), true -} diff --git a/test/vendor/golang.org/x/net/http2/client_conn_pool.go b/test/vendor/golang.org/x/net/http2/client_conn_pool.go index 652bc11a02..3a67636fe2 100644 --- a/test/vendor/golang.org/x/net/http2/client_conn_pool.go +++ b/test/vendor/golang.org/x/net/http2/client_conn_pool.go @@ -7,9 +7,7 @@ package http2 import ( - "context" "crypto/tls" - "errors" "net/http" "sync" ) @@ -80,69 +78,61 @@ func (p *clientConnPool) getClientConn(req *http.Request, addr string, dialOnMis // It gets its own connection. traceGetConn(req, addr) const singleUse = true - cc, err := p.t.dialClientConn(req.Context(), addr, singleUse) + cc, err := p.t.dialClientConn(addr, singleUse) if err != nil { return nil, err } return cc, nil } - for { - p.mu.Lock() - for _, cc := range p.conns[addr] { - if st := cc.idleState(); st.canTakeNewRequest { - if p.shouldTraceGetConn(st) { - traceGetConn(req, addr) - } - p.mu.Unlock() - return cc, nil + p.mu.Lock() + for _, cc := range p.conns[addr] { + if st := cc.idleState(); st.canTakeNewRequest { + if p.shouldTraceGetConn(st) { + traceGetConn(req, addr) } - } - if !dialOnMiss { p.mu.Unlock() - return nil, ErrNoCachedConn + return cc, nil } - traceGetConn(req, addr) - call := p.getStartDialLocked(req.Context(), addr) + } + if !dialOnMiss { p.mu.Unlock() - <-call.done - if shouldRetryDial(call, req) { - continue - } - return call.res, call.err + return nil, ErrNoCachedConn } + traceGetConn(req, addr) + call := p.getStartDialLocked(addr) + p.mu.Unlock() + <-call.done + return call.res, call.err } // dialCall is an in-flight Transport dial call to a host. type dialCall struct { - _ incomparable - p *clientConnPool - // the context associated with the request - // that created this dialCall - ctx context.Context + _ incomparable + p *clientConnPool done chan struct{} // closed when done res *ClientConn // valid after done is closed err error // valid after done is closed } // requires p.mu is held. -func (p *clientConnPool) getStartDialLocked(ctx context.Context, addr string) *dialCall { +func (p *clientConnPool) getStartDialLocked(addr string) *dialCall { if call, ok := p.dialing[addr]; ok { // A dial is already in-flight. Don't start another. return call } - call := &dialCall{p: p, done: make(chan struct{}), ctx: ctx} + call := &dialCall{p: p, done: make(chan struct{})} if p.dialing == nil { p.dialing = make(map[string]*dialCall) } p.dialing[addr] = call - go call.dial(call.ctx, addr) + go call.dial(addr) return call } // run in its own goroutine. -func (c *dialCall) dial(ctx context.Context, addr string) { +func (c *dialCall) dial(addr string) { const singleUse = false // shared conn - c.res, c.err = c.p.t.dialClientConn(ctx, addr, singleUse) + c.res, c.err = c.p.t.dialClientConn(addr, singleUse) close(c.done) c.p.mu.Lock() @@ -286,28 +276,3 @@ type noDialClientConnPool struct{ *clientConnPool } func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { return p.getClientConn(req, addr, noDialOnMiss) } - -// shouldRetryDial reports whether the current request should -// retry dialing after the call finished unsuccessfully, for example -// if the dial was canceled because of a context cancellation or -// deadline expiry. -func shouldRetryDial(call *dialCall, req *http.Request) bool { - if call.err == nil { - // No error, no need to retry - return false - } - if call.ctx == req.Context() { - // If the call has the same context as the request, the dial - // should not be retried, since any cancellation will have come - // from this request. - return false - } - if !errors.Is(call.err, context.Canceled) && !errors.Is(call.err, context.DeadlineExceeded) { - // If the call error is not because of a context cancellation or a deadline expiry, - // the dial should not be retried. - return false - } - // Only retry if the error is a context cancellation error or deadline expiry - // and the context associated with the call was canceled or expired. - return call.ctx.Err() != nil -} diff --git a/test/vendor/golang.org/x/net/http2/go115.go b/test/vendor/golang.org/x/net/http2/go115.go deleted file mode 100644 index 908af1ab93..0000000000 --- a/test/vendor/golang.org/x/net/http2/go115.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.15 -// +build go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS -// connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - dialer := &tls.Dialer{ - Config: cfg, - } - cn, err := dialer.DialContext(ctx, network, addr) - if err != nil { - return nil, err - } - tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed - return tlsCn, nil -} diff --git a/test/vendor/golang.org/x/net/http2/headermap.go b/test/vendor/golang.org/x/net/http2/headermap.go index 9e12941da4..c3ff3fa1c7 100644 --- a/test/vendor/golang.org/x/net/http2/headermap.go +++ b/test/vendor/golang.org/x/net/http2/headermap.go @@ -6,6 +6,7 @@ package http2 import ( "net/http" + "strings" "sync" ) @@ -78,10 +79,10 @@ func buildCommonHeaderMaps() { } } -func lowerHeader(v string) (lower string, ascii bool) { +func lowerHeader(v string) string { buildCommonHeaderMapsOnce() if s, ok := commonLowerHeader[v]; ok { - return s, true + return s } - return asciiToLower(v) + return strings.ToLower(v) } diff --git a/test/vendor/golang.org/x/net/http2/not_go115.go b/test/vendor/golang.org/x/net/http2/not_go115.go deleted file mode 100644 index e6c04cf7ac..0000000000 --- a/test/vendor/golang.org/x/net/http2/not_go115.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.15 -// +build !go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext opens a TLS connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if cfg.InsecureSkipVerify { - return cn, nil - } - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - return cn, nil -} diff --git a/test/vendor/golang.org/x/net/http2/server.go b/test/vendor/golang.org/x/net/http2/server.go index 19e449cfae..e125bbd2a2 100644 --- a/test/vendor/golang.org/x/net/http2/server.go +++ b/test/vendor/golang.org/x/net/http2/server.go @@ -231,12 +231,13 @@ func ConfigureServer(s *http.Server, conf *Server) error { if s.TLSConfig == nil { s.TLSConfig = new(tls.Config) - } else if s.TLSConfig.CipherSuites != nil && s.TLSConfig.MinVersion < tls.VersionTLS13 { - // If they already provided a TLS 1.0–1.2 CipherSuite list, return an - // error if it is missing ECDHE_RSA_WITH_AES_128_GCM_SHA256 or - // ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. + } else if s.TLSConfig.CipherSuites != nil { + // If they already provided a CipherSuite list, return + // an error if it has a bad order or is missing + // ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. haveRequired := false - for _, cs := range s.TLSConfig.CipherSuites { + sawBad := false + for i, cs := range s.TLSConfig.CipherSuites { switch cs { case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, // Alternative MTI cipher to not discourage ECDSA-only servers. @@ -244,9 +245,14 @@ func ConfigureServer(s *http.Server, conf *Server) error { tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: haveRequired = true } + if isBadCipher(cs) { + sawBad = true + } else if sawBad { + return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs) + } } if !haveRequired { - return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)") + return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).") } } @@ -259,11 +265,15 @@ func ConfigureServer(s *http.Server, conf *Server) error { s.TLSConfig.PreferServerCipherSuites = true - if !strSliceContains(s.TLSConfig.NextProtos, NextProtoTLS) { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) + haveNPN := false + for _, p := range s.TLSConfig.NextProtos { + if p == NextProtoTLS { + haveNPN = true + break + } } - if !strSliceContains(s.TLSConfig.NextProtos, "http/1.1") { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, "http/1.1") + if !haveNPN { + s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) } if s.TLSNextProto == nil { @@ -816,7 +826,7 @@ func (sc *serverConn) serve() { }) sc.unackedSettings++ - // Each connection starts with initialWindowSize inflow tokens. + // Each connection starts with intialWindowSize inflow tokens. // If a higher value is configured, we add more tokens. if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 { sc.sendWindowUpdate(nil, int(diff)) @@ -856,15 +866,6 @@ func (sc *serverConn) serve() { case res := <-sc.wroteFrameCh: sc.wroteFrame(res) case res := <-sc.readFrameCh: - // Process any written frames before reading new frames from the client since a - // written frame could have triggered a new stream to be started. - if sc.writingFrameAsync { - select { - case wroteRes := <-sc.wroteFrameCh: - sc.wroteFrame(wroteRes) - default: - } - } if !sc.processFrameFromReader(res) { return } @@ -2788,12 +2789,8 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error { // but PUSH_PROMISE requests cannot have a body. // http://tools.ietf.org/html/rfc7540#section-8.2 // Also disallow Host, since the promised URL must be absolute. - if asciiEqualFold(k, "content-length") || - asciiEqualFold(k, "content-encoding") || - asciiEqualFold(k, "trailer") || - asciiEqualFold(k, "te") || - asciiEqualFold(k, "expect") || - asciiEqualFold(k, "host") { + switch strings.ToLower(k) { + case "content-length", "content-encoding", "trailer", "te", "expect", "host": return fmt.Errorf("promised request headers cannot include %q", k) } } diff --git a/test/vendor/golang.org/x/net/http2/transport.go b/test/vendor/golang.org/x/net/http2/transport.go index b261beb1d0..7688d72c39 100644 --- a/test/vendor/golang.org/x/net/http2/transport.go +++ b/test/vendor/golang.org/x/net/http2/transport.go @@ -264,8 +264,9 @@ type ClientConn struct { peerMaxHeaderListSize uint64 initialWindowSize uint32 - hbuf bytes.Buffer // HPACK encoder writes into this - henc *hpack.Encoder + hbuf bytes.Buffer // HPACK encoder writes into this + henc *hpack.Encoder + freeBuf [][]byte wmu sync.Mutex // held while writing; acquire AFTER mu if holding both werr error // first write error that has occurred @@ -385,13 +386,8 @@ func (cs *clientStream) abortRequestBodyWrite(err error) { } cc := cs.cc cc.mu.Lock() - if cs.stopReqBody == nil { - cs.stopReqBody = err - if cs.req.Body != nil { - cs.req.Body.Close() - } - cc.cond.Broadcast() - } + cs.stopReqBody = err + cc.cond.Broadcast() cc.mu.Unlock() } @@ -568,12 +564,12 @@ func canRetryError(err error) bool { return false } -func (t *Transport) dialClientConn(ctx context.Context, addr string, singleUse bool) (*ClientConn, error) { +func (t *Transport) dialClientConn(addr string, singleUse bool) (*ClientConn, error) { host, _, err := net.SplitHostPort(addr) if err != nil { return nil, err } - tconn, err := t.dialTLS(ctx)("tcp", addr, t.newTLSConfig(host)) + tconn, err := t.dialTLS()("tcp", addr, t.newTLSConfig(host)) if err != nil { return nil, err } @@ -594,24 +590,34 @@ func (t *Transport) newTLSConfig(host string) *tls.Config { return cfg } -func (t *Transport) dialTLS(ctx context.Context) func(string, string, *tls.Config) (net.Conn, error) { +func (t *Transport) dialTLS() func(string, string, *tls.Config) (net.Conn, error) { if t.DialTLS != nil { return t.DialTLS } - return func(network, addr string, cfg *tls.Config) (net.Conn, error) { - tlsCn, err := t.dialTLSWithContext(ctx, network, addr, cfg) - if err != nil { + return t.dialTLSDefault +} + +func (t *Transport) dialTLSDefault(network, addr string, cfg *tls.Config) (net.Conn, error) { + cn, err := tls.Dial(network, addr, cfg) + if err != nil { + return nil, err + } + if err := cn.Handshake(); err != nil { + return nil, err + } + if !cfg.InsecureSkipVerify { + if err := cn.VerifyHostname(cfg.ServerName); err != nil { return nil, err } - state := tlsCn.ConnectionState() - if p := state.NegotiatedProtocol; p != NextProtoTLS { - return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) - } - if !state.NegotiatedProtocolIsMutual { - return nil, errors.New("http2: could not negotiate protocol mutually") - } - return tlsCn, nil } + state := cn.ConnectionState() + if p := state.NegotiatedProtocol; p != NextProtoTLS { + return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) + } + if !state.NegotiatedProtocolIsMutual { + return nil, errors.New("http2: could not negotiate protocol mutually") + } + return cn, nil } // disableKeepAlives reports whether connections should be closed as @@ -917,6 +923,46 @@ func (cc *ClientConn) closeForLostPing() error { return cc.closeForError(err) } +const maxAllocFrameSize = 512 << 10 + +// frameBuffer returns a scratch buffer suitable for writing DATA frames. +// They're capped at the min of the peer's max frame size or 512KB +// (kinda arbitrarily), but definitely capped so we don't allocate 4GB +// bufers. +func (cc *ClientConn) frameScratchBuffer() []byte { + cc.mu.Lock() + size := cc.maxFrameSize + if size > maxAllocFrameSize { + size = maxAllocFrameSize + } + for i, buf := range cc.freeBuf { + if len(buf) >= int(size) { + cc.freeBuf[i] = nil + cc.mu.Unlock() + return buf[:size] + } + } + cc.mu.Unlock() + return make([]byte, size) +} + +func (cc *ClientConn) putFrameScratchBuffer(buf []byte) { + cc.mu.Lock() + defer cc.mu.Unlock() + const maxBufs = 4 // arbitrary; 4 concurrent requests per conn? investigate. + if len(cc.freeBuf) < maxBufs { + cc.freeBuf = append(cc.freeBuf, buf) + return + } + for i, old := range cc.freeBuf { + if old == nil { + cc.freeBuf[i] = buf + return + } + } + // forget about it. +} + // errRequestCanceled is a copy of net/http's errRequestCanceled because it's not // exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. var errRequestCanceled = errors.New("net/http: request canceled") @@ -959,7 +1005,7 @@ func checkConnHeaders(req *http.Request) error { if vv := req.Header["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") { return fmt.Errorf("http2: invalid Transfer-Encoding request header: %q", vv) } - if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !asciiEqualFold(vv[0], "close") && !asciiEqualFold(vv[0], "keep-alive")) { + if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !strings.EqualFold(vv[0], "close") && !strings.EqualFold(vv[0], "keep-alive")) { return fmt.Errorf("http2: invalid Connection request header: %q", vv) } return nil @@ -1115,28 +1161,40 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf return res, false, nil } - handleError := func(err error) (*http.Response, bool, error) { - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - <-bodyWriter.resc - } - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), err - } - for { select { case re := <-readLoopResCh: return handleReadLoopResponse(re) case <-respHeaderTimer: - return handleError(errTimeout) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), errTimeout case <-ctx.Done(): - return handleError(ctx.Err()) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), ctx.Err() case <-req.Cancel: - return handleError(errRequestCanceled) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + bodyWriter.cancel() + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + <-bodyWriter.resc + } + cc.forgetStreamID(cs.ID) + return nil, cs.getStartedWrite(), errRequestCanceled case <-cs.peerReset: // processResetStream already removed the // stream from the streams map; no need for @@ -1247,35 +1305,11 @@ var ( errReqBodyTooLong = errors.New("http2: request body larger than specified content length") ) -// frameScratchBufferLen returns the length of a buffer to use for -// outgoing request bodies to read/write to/from. -// -// It returns max(1, min(peer's advertised max frame size, -// Request.ContentLength+1, 512KB)). -func (cs *clientStream) frameScratchBufferLen(maxFrameSize int) int { - const max = 512 << 10 - n := int64(maxFrameSize) - if n > max { - n = max - } - if cl := actualContentLength(cs.req); cl != -1 && cl+1 < n { - // Add an extra byte past the declared content-length to - // give the caller's Request.Body io.Reader a chance to - // give us more bytes than they declared, so we can catch it - // early. - n = cl + 1 - } - if n < 1 { - return 1 - } - return int(n) // doesn't truncate; max is 512K -} - -var bufPool sync.Pool // of *[]byte - func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { cc := cs.cc sentEnd := false // whether we sent the final DATA frame w/ END_STREAM + buf := cc.frameScratchBuffer() + defer cc.putFrameScratchBuffer(buf) defer func() { traceWroteRequest(cs.trace, err) @@ -1283,13 +1317,7 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( // Request.Body is closed by the Transport, // and in multiple cases: server replies <=299 and >299 // while still writing request body - var cerr error - cc.mu.Lock() - if cs.stopReqBody == nil { - cs.stopReqBody = errStopReqBodyWrite - cerr = bodyCloser.Close() - } - cc.mu.Unlock() + cerr := bodyCloser.Close() if err == nil { err = cerr } @@ -1300,24 +1328,9 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( remainLen := actualContentLength(req) hasContentLen := remainLen != -1 - cc.mu.Lock() - maxFrameSize := int(cc.maxFrameSize) - cc.mu.Unlock() - - // Scratch buffer for reading into & writing from. - scratchLen := cs.frameScratchBufferLen(maxFrameSize) - var buf []byte - if bp, ok := bufPool.Get().(*[]byte); ok && len(*bp) >= scratchLen { - defer bufPool.Put(bp) - buf = *bp - } else { - buf = make([]byte, scratchLen) - defer bufPool.Put(&buf) - } - var sawEOF bool for !sawEOF { - n, err := body.Read(buf[:len(buf)]) + n, err := body.Read(buf[:len(buf)-1]) if hasContentLen { remainLen -= int64(n) if remainLen == 0 && err == nil { @@ -1328,9 +1341,8 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( // to send the END_STREAM bit early, double-check that we're actually // at EOF. Subsequent reads should return (0, EOF) at this point. // If either value is different, we return an error in one of two ways below. - var scratch [1]byte var n1 int - n1, err = body.Read(scratch[:]) + n1, err = body.Read(buf[n:]) remainLen -= int64(n1) } if remainLen < 0 { @@ -1400,6 +1412,10 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( } } + cc.mu.Lock() + maxFrameSize := int(cc.maxFrameSize) + cc.mu.Unlock() + cc.wmu.Lock() defer cc.wmu.Unlock() @@ -1515,21 +1531,19 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail var didUA bool for k, vv := range req.Header { - if asciiEqualFold(k, "host") || asciiEqualFold(k, "content-length") { + if strings.EqualFold(k, "host") || strings.EqualFold(k, "content-length") { // Host is :authority, already sent. // Content-Length is automatic, set below. continue - } else if asciiEqualFold(k, "connection") || - asciiEqualFold(k, "proxy-connection") || - asciiEqualFold(k, "transfer-encoding") || - asciiEqualFold(k, "upgrade") || - asciiEqualFold(k, "keep-alive") { + } else if strings.EqualFold(k, "connection") || strings.EqualFold(k, "proxy-connection") || + strings.EqualFold(k, "transfer-encoding") || strings.EqualFold(k, "upgrade") || + strings.EqualFold(k, "keep-alive") { // Per 8.1.2.2 Connection-Specific Header // Fields, don't send connection-specific // fields. We have already checked if any // are error-worthy so just ignore the rest. continue - } else if asciiEqualFold(k, "user-agent") { + } else if strings.EqualFold(k, "user-agent") { // Match Go's http1 behavior: at most one // User-Agent. If set to nil or empty string, // then omit it. Otherwise if not mentioned, @@ -1542,7 +1556,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail if vv[0] == "" { continue } - } else if asciiEqualFold(k, "cookie") { + } else if strings.EqualFold(k, "cookie") { // Per 8.1.2.5 To allow for better compression efficiency, the // Cookie header field MAY be split into separate header fields, // each with one or more cookie-pairs. @@ -1601,12 +1615,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail // Header list size is ok. Write the headers. enumerateHeaders(func(name, value string) { - name, ascii := asciiToLower(name) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - return - } + name = strings.ToLower(name) cc.writeHeader(name, value) if traceHeaders { traceWroteHeaderField(trace, name, value) @@ -1654,14 +1663,9 @@ func (cc *ClientConn) encodeTrailers(req *http.Request) ([]byte, error) { } for k, vv := range req.Trailer { - lowKey, ascii := asciiToLower(k) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - continue - } // Transfer-Encoding, etc.. have already been filtered at the // start of RoundTrip + lowKey := strings.ToLower(k) for _, v := range vv { cc.writeHeader(lowKey, v) } diff --git a/test/vendor/golang.org/x/net/http2/write.go b/test/vendor/golang.org/x/net/http2/write.go index 33f61398a1..3849bc2632 100644 --- a/test/vendor/golang.org/x/net/http2/write.go +++ b/test/vendor/golang.org/x/net/http2/write.go @@ -341,12 +341,7 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) { } for _, k := range keys { vv := h[k] - k, ascii := lowerHeader(k) - if !ascii { - // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header - // field names have to be ASCII characters (just as in HTTP/1.x). - continue - } + k = lowerHeader(k) if !validWireHeaderFieldName(k) { // Skip it as backup paranoia. Per // golang.org/issue/14048, these should diff --git a/test/vendor/golang.org/x/net/idna/idna10.0.0.go b/test/vendor/golang.org/x/net/idna/idna10.0.0.go index 5208ba6cb8..7e69ee1b22 100644 --- a/test/vendor/golang.org/x/net/idna/idna10.0.0.go +++ b/test/vendor/golang.org/x/net/idna/idna10.0.0.go @@ -67,14 +67,15 @@ func Transitional(transitional bool) Option { // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts // are longer than allowed by the RFC. -// -// This option corresponds to the VerifyDnsLength flag in UTS #46. func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } // RemoveLeadingDots removes leading label separators. Leading runes that map to // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. +// +// This is the behavior suggested by the UTS #46 and is adopted by some +// browsers. func RemoveLeadingDots(remove bool) Option { return func(o *options) { o.removeLeadingDots = remove } } @@ -82,8 +83,6 @@ func RemoveLeadingDots(remove bool) Option { // ValidateLabels sets whether to check the mandatory label validation criteria // as defined in Section 5.4 of RFC 5891. This includes testing for correct use // of hyphens ('-'), normalization, validity of runes, and the context rules. -// In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags -// in UTS #46. func ValidateLabels(enable bool) Option { return func(o *options) { // Don't override existing mappings, but set one that at least checks @@ -92,48 +91,25 @@ func ValidateLabels(enable bool) Option { o.mapping = normalize } o.trie = trie - o.checkJoiners = enable - o.checkHyphens = enable - if enable { - o.fromPuny = validateFromPunycode - } else { - o.fromPuny = nil - } - } -} - -// CheckHyphens sets whether to check for correct use of hyphens ('-') in -// labels. Most web browsers do not have this option set, since labels such as -// "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. -// -// This option corresponds to the CheckHyphens flag in UTS #46. -func CheckHyphens(enable bool) Option { - return func(o *options) { o.checkHyphens = enable } -} - -// CheckJoiners sets whether to check the ContextJ rules as defined in Appendix -// A of RFC 5892, concerning the use of joiner runes. -// -// This option corresponds to the CheckJoiners flag in UTS #46. -func CheckJoiners(enable bool) Option { - return func(o *options) { - o.trie = trie - o.checkJoiners = enable + o.validateLabels = enable + o.fromPuny = validateFromPunycode } } // StrictDomainName limits the set of permissible ASCII characters to those // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration, -// but is only useful if ValidateLabels is set. +// hyphen). This is set by default for MapForLookup and ValidateForRegistration. // // This option is useful, for instance, for browsers that allow characters // outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details. -// -// This option corresponds to the UseSTD3ASCIIRules flag in UTS #46. +// http://www.rfc-editor.org/std/std3.txt for more details This option +// corresponds to the UseSTD3ASCIIRules option in UTS #46. func StrictDomainName(use bool) Option { - return func(o *options) { o.useSTD3Rules = use } + return func(o *options) { + o.trie = trie + o.useSTD3Rules = use + o.fromPuny = validateFromPunycode + } } // NOTE: the following options pull in tables. The tables should not be linked @@ -141,8 +117,6 @@ func StrictDomainName(use bool) Option { // BidiRule enables the Bidi rule as defined in RFC 5893. Any application // that relies on proper validation of labels should include this rule. -// -// This option corresponds to the CheckBidi flag in UTS #46. func BidiRule() Option { return func(o *options) { o.bidirule = bidirule.ValidString } } @@ -178,8 +152,7 @@ func MapForLookup() Option { type options struct { transitional bool useSTD3Rules bool - checkHyphens bool - checkJoiners bool + validateLabels bool verifyDNSLength bool removeLeadingDots bool @@ -252,11 +225,8 @@ func (p *Profile) String() string { if p.useSTD3Rules { s += ":UseSTD3Rules" } - if p.checkHyphens { - s += ":CheckHyphens" - } - if p.checkJoiners { - s += ":CheckJoiners" + if p.validateLabels { + s += ":ValidateLabels" } if p.verifyDNSLength { s += ":VerifyDNSLength" @@ -284,29 +254,26 @@ var ( punycode = &Profile{} lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, + transitional: true, + useSTD3Rules: true, + validateLabels: true, + trie: trie, + fromPuny: validateFromPunycode, + mapping: validateAndMap, + bidirule: bidirule.ValidString, }} display = &Profile{options{ - useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, + useSTD3Rules: true, + validateLabels: true, + trie: trie, + fromPuny: validateFromPunycode, + mapping: validateAndMap, + bidirule: bidirule.ValidString, }} registration = &Profile{options{ useSTD3Rules: true, + validateLabels: true, verifyDNSLength: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateRegistration, @@ -373,7 +340,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { } isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight labels.set(u) - if err == nil && p.fromPuny != nil { + if err == nil && p.validateLabels { err = p.fromPuny(p, u) } if err == nil { @@ -714,18 +681,16 @@ func (p *Profile) validateLabel(s string) (err error) { } return nil } - if p.checkHyphens { - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - } - if !p.checkJoiners { + if !p.validateLabels { return nil } - trie := p.trie // p.checkJoiners is only set if trie is set. + trie := p.trie // p.validateLabels is only set if trie is set. + if len(s) > 4 && s[2] == '-' && s[3] == '-' { + return &labelError{s, "V2"} + } + if s[0] == '-' || s[len(s)-1] == '-' { + return &labelError{s, "V3"} + } // TODO: merge the use of this in the trie. v, sz := trie.lookupString(s) x := info(v) diff --git a/test/vendor/golang.org/x/net/idna/idna9.0.0.go b/test/vendor/golang.org/x/net/idna/idna9.0.0.go index 55f718f127..7c7456374c 100644 --- a/test/vendor/golang.org/x/net/idna/idna9.0.0.go +++ b/test/vendor/golang.org/x/net/idna/idna9.0.0.go @@ -66,14 +66,15 @@ func Transitional(transitional bool) Option { // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts // are longer than allowed by the RFC. -// -// This option corresponds to the VerifyDnsLength flag in UTS #46. func VerifyDNSLength(verify bool) Option { return func(o *options) { o.verifyDNSLength = verify } } // RemoveLeadingDots removes leading label separators. Leading runes that map to // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. +// +// This is the behavior suggested by the UTS #46 and is adopted by some +// browsers. func RemoveLeadingDots(remove bool) Option { return func(o *options) { o.removeLeadingDots = remove } } @@ -81,8 +82,6 @@ func RemoveLeadingDots(remove bool) Option { // ValidateLabels sets whether to check the mandatory label validation criteria // as defined in Section 5.4 of RFC 5891. This includes testing for correct use // of hyphens ('-'), normalization, validity of runes, and the context rules. -// In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags -// in UTS #46. func ValidateLabels(enable bool) Option { return func(o *options) { // Don't override existing mappings, but set one that at least checks @@ -91,48 +90,25 @@ func ValidateLabels(enable bool) Option { o.mapping = normalize } o.trie = trie - o.checkJoiners = enable - o.checkHyphens = enable - if enable { - o.fromPuny = validateFromPunycode - } else { - o.fromPuny = nil - } - } -} - -// CheckHyphens sets whether to check for correct use of hyphens ('-') in -// labels. Most web browsers do not have this option set, since labels such as -// "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. -// -// This option corresponds to the CheckHyphens flag in UTS #46. -func CheckHyphens(enable bool) Option { - return func(o *options) { o.checkHyphens = enable } -} - -// CheckJoiners sets whether to check the ContextJ rules as defined in Appendix -// A of RFC 5892, concerning the use of joiner runes. -// -// This option corresponds to the CheckJoiners flag in UTS #46. -func CheckJoiners(enable bool) Option { - return func(o *options) { - o.trie = trie - o.checkJoiners = enable + o.validateLabels = enable + o.fromPuny = validateFromPunycode } } // StrictDomainName limits the set of permissable ASCII characters to those // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration, -// but is only useful if ValidateLabels is set. +// hyphen). This is set by default for MapForLookup and ValidateForRegistration. // // This option is useful, for instance, for browsers that allow characters // outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details. -// -// This option corresponds to the UseSTD3ASCIIRules flag in UTS #46. +// http://www.rfc-editor.org/std/std3.txt for more details This option +// corresponds to the UseSTD3ASCIIRules option in UTS #46. func StrictDomainName(use bool) Option { - return func(o *options) { o.useSTD3Rules = use } + return func(o *options) { + o.trie = trie + o.useSTD3Rules = use + o.fromPuny = validateFromPunycode + } } // NOTE: the following options pull in tables. The tables should not be linked @@ -140,8 +116,6 @@ func StrictDomainName(use bool) Option { // BidiRule enables the Bidi rule as defined in RFC 5893. Any application // that relies on proper validation of labels should include this rule. -// -// This option corresponds to the CheckBidi flag in UTS #46. func BidiRule() Option { return func(o *options) { o.bidirule = bidirule.ValidString } } @@ -178,8 +152,7 @@ func MapForLookup() Option { type options struct { transitional bool useSTD3Rules bool - checkHyphens bool - checkJoiners bool + validateLabels bool verifyDNSLength bool removeLeadingDots bool @@ -252,11 +225,8 @@ func (p *Profile) String() string { if p.useSTD3Rules { s += ":UseSTD3Rules" } - if p.checkHyphens { - s += ":CheckHyphens" - } - if p.checkJoiners { - s += ":CheckJoiners" + if p.validateLabels { + s += ":ValidateLabels" } if p.verifyDNSLength { s += ":VerifyDNSLength" @@ -285,10 +255,9 @@ var ( punycode = &Profile{} lookup = &Profile{options{ transitional: true, - removeLeadingDots: true, useSTD3Rules: true, - checkHyphens: true, - checkJoiners: true, + validateLabels: true, + removeLeadingDots: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateAndMap, @@ -296,9 +265,8 @@ var ( }} display = &Profile{options{ useSTD3Rules: true, + validateLabels: true, removeLeadingDots: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateAndMap, @@ -306,9 +274,8 @@ var ( }} registration = &Profile{options{ useSTD3Rules: true, + validateLabels: true, verifyDNSLength: true, - checkHyphens: true, - checkJoiners: true, trie: trie, fromPuny: validateFromPunycode, mapping: validateRegistration, @@ -372,7 +339,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { continue } labels.set(u) - if err == nil && p.fromPuny != nil { + if err == nil && p.validateLabels { err = p.fromPuny(p, u) } if err == nil { @@ -662,18 +629,16 @@ func (p *Profile) validateLabel(s string) error { if p.bidirule != nil && !p.bidirule(s) { return &labelError{s, "B"} } - if p.checkHyphens { - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - } - if !p.checkJoiners { + if !p.validateLabels { return nil } - trie := p.trie // p.checkJoiners is only set if trie is set. + trie := p.trie // p.validateLabels is only set if trie is set. + if len(s) > 4 && s[2] == '-' && s[3] == '-' { + return &labelError{s, "V2"} + } + if s[0] == '-' || s[len(s)-1] == '-' { + return &labelError{s, "V3"} + } // TODO: merge the use of this in the trie. v, sz := trie.lookupString(s) x := info(v) diff --git a/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go b/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go index 8a7392c4a1..e4c62289f9 100644 --- a/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +++ b/test/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.10 // +build go1.10 package bidirule diff --git a/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go b/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go index bb0a920018..02b9e1e9d4 100644 --- a/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +++ b/test/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.10 // +build !go1.10 package bidirule diff --git a/test/vendor/golang.org/x/text/unicode/bidi/bidi.go b/test/vendor/golang.org/x/text/unicode/bidi/bidi.go index fd057601bd..e8edc54cc2 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/bidi.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/bidi.go @@ -12,14 +12,15 @@ // and without notice. package bidi // import "golang.org/x/text/unicode/bidi" -// TODO +// TODO: +// The following functionality would not be hard to implement, but hinges on +// the definition of a Segmenter interface. For now this is up to the user. +// - Iterate over paragraphs +// - Segmenter to iterate over runs directly from a given text. +// Also: // - Transformer for reordering? // - Transformer (validator, really) for Bidi Rule. -import ( - "bytes" -) - // This API tries to avoid dealing with embedding levels for now. Under the hood // these will be computed, but the question is to which extent the user should // know they exist. We should at some point allow the user to specify an @@ -48,9 +49,7 @@ const ( Neutral ) -type options struct { - defaultDirection Direction -} +type options struct{} // An Option is an option for Bidi processing. type Option func(*options) @@ -67,62 +66,12 @@ type Option func(*options) // DefaultDirection sets the default direction for a Paragraph. The direction is // overridden if the text contains directional characters. func DefaultDirection(d Direction) Option { - return func(opts *options) { - opts.defaultDirection = d - } + panic("unimplemented") } // A Paragraph holds a single Paragraph for Bidi processing. type Paragraph struct { - p []byte - o Ordering - opts []Option - types []Class - pairTypes []bracketType - pairValues []rune - runes []rune - options options -} - -// Initialize the p.pairTypes, p.pairValues and p.types from the input previously -// set by p.SetBytes() or p.SetString(). Also limit the input up to (and including) a paragraph -// separator (bidi class B). -// -// The function p.Order() needs these values to be set, so this preparation could be postponed. -// But since the SetBytes and SetStrings functions return the length of the input up to the paragraph -// separator, the whole input needs to be processed anyway and should not be done twice. -// -// The function has the same return values as SetBytes() / SetString() -func (p *Paragraph) prepareInput() (n int, err error) { - p.runes = bytes.Runes(p.p) - bytecount := 0 - // clear slices from previous SetString or SetBytes - p.pairTypes = nil - p.pairValues = nil - p.types = nil - - for _, r := range p.runes { - props, i := LookupRune(r) - bytecount += i - cls := props.Class() - if cls == B { - return bytecount, nil - } - p.types = append(p.types, cls) - if props.IsOpeningBracket() { - p.pairTypes = append(p.pairTypes, bpOpen) - p.pairValues = append(p.pairValues, r) - } else if props.IsBracket() { - // this must be a closing bracket, - // since IsOpeningBracket is not true - p.pairTypes = append(p.pairTypes, bpClose) - p.pairValues = append(p.pairValues, r) - } else { - p.pairTypes = append(p.pairTypes, bpNone) - p.pairValues = append(p.pairValues, 0) - } - } - return bytecount, nil + // buffers } // SetBytes configures p for the given paragraph text. It replaces text @@ -131,150 +80,70 @@ func (p *Paragraph) prepareInput() (n int, err error) { // consumed from b including this separator. Error may be non-nil if options are // given. func (p *Paragraph) SetBytes(b []byte, opts ...Option) (n int, err error) { - p.p = b - p.opts = opts - return p.prepareInput() + panic("unimplemented") } -// SetString configures s for the given paragraph text. It replaces text -// previously set by SetBytes or SetString. If s contains a paragraph separator +// SetString configures p for the given paragraph text. It replaces text +// previously set by SetBytes or SetString. If b contains a paragraph separator // it will only process the first paragraph and report the number of bytes -// consumed from s including this separator. Error may be non-nil if options are +// consumed from b including this separator. Error may be non-nil if options are // given. func (p *Paragraph) SetString(s string, opts ...Option) (n int, err error) { - p.p = []byte(s) - p.opts = opts - return p.prepareInput() + panic("unimplemented") } // IsLeftToRight reports whether the principle direction of rendering for this // paragraphs is left-to-right. If this returns false, the principle direction // of rendering is right-to-left. func (p *Paragraph) IsLeftToRight() bool { - return p.Direction() == LeftToRight + panic("unimplemented") } // Direction returns the direction of the text of this paragraph. // // The direction may be LeftToRight, RightToLeft, Mixed, or Neutral. func (p *Paragraph) Direction() Direction { - return p.o.Direction() + panic("unimplemented") } -// TODO: what happens if the position is > len(input)? This should return an error. - // RunAt reports the Run at the given position of the input text. // // This method can be used for computing line breaks on paragraphs. func (p *Paragraph) RunAt(pos int) Run { - c := 0 - runNumber := 0 - for i, r := range p.o.runes { - c += len(r) - if pos < c { - runNumber = i - } - } - return p.o.Run(runNumber) -} - -func calculateOrdering(levels []level, runes []rune) Ordering { - var curDir Direction - - prevDir := Neutral - prevI := 0 - - o := Ordering{} - // lvl = 0,2,4,...: left to right - // lvl = 1,3,5,...: right to left - for i, lvl := range levels { - if lvl%2 == 0 { - curDir = LeftToRight - } else { - curDir = RightToLeft - } - if curDir != prevDir { - if i > 0 { - o.runes = append(o.runes, runes[prevI:i]) - o.directions = append(o.directions, prevDir) - o.startpos = append(o.startpos, prevI) - } - prevI = i - prevDir = curDir - } - } - o.runes = append(o.runes, runes[prevI:]) - o.directions = append(o.directions, prevDir) - o.startpos = append(o.startpos, prevI) - return o + panic("unimplemented") } // Order computes the visual ordering of all the runs in a Paragraph. func (p *Paragraph) Order() (Ordering, error) { - if len(p.types) == 0 { - return Ordering{}, nil - } - - for _, fn := range p.opts { - fn(&p.options) - } - lvl := level(-1) - if p.options.defaultDirection == RightToLeft { - lvl = 1 - } - para, err := newParagraph(p.types, p.pairTypes, p.pairValues, lvl) - if err != nil { - return Ordering{}, err - } - - levels := para.getLevels([]int{len(p.types)}) - - p.o = calculateOrdering(levels, p.runes) - return p.o, nil + panic("unimplemented") } // Line computes the visual ordering of runs for a single line starting and // ending at the given positions in the original text. func (p *Paragraph) Line(start, end int) (Ordering, error) { - lineTypes := p.types[start:end] - para, err := newParagraph(lineTypes, p.pairTypes[start:end], p.pairValues[start:end], -1) - if err != nil { - return Ordering{}, err - } - levels := para.getLevels([]int{len(lineTypes)}) - o := calculateOrdering(levels, p.runes[start:end]) - return o, nil + panic("unimplemented") } // An Ordering holds the computed visual order of runs of a Paragraph. Calling // SetBytes or SetString on the originating Paragraph invalidates an Ordering. // The methods of an Ordering should only be called by one goroutine at a time. -type Ordering struct { - runes [][]rune - directions []Direction - startpos []int -} +type Ordering struct{} // Direction reports the directionality of the runs. // // The direction may be LeftToRight, RightToLeft, Mixed, or Neutral. func (o *Ordering) Direction() Direction { - return o.directions[0] + panic("unimplemented") } // NumRuns returns the number of runs. func (o *Ordering) NumRuns() int { - return len(o.runes) + panic("unimplemented") } // Run returns the ith run within the ordering. func (o *Ordering) Run(i int) Run { - r := Run{ - runes: o.runes[i], - direction: o.directions[i], - startpos: o.startpos[i], - } - return r + panic("unimplemented") } // TODO: perhaps with options. @@ -286,19 +155,16 @@ func (o *Ordering) Run(i int) Run { // A Run is a continuous sequence of characters of a single direction. type Run struct { - runes []rune - direction Direction - startpos int } // String returns the text of the run in its original order. func (r *Run) String() string { - return string(r.runes) + panic("unimplemented") } // Bytes returns the text of the run in its original order. func (r *Run) Bytes() []byte { - return []byte(r.String()) + panic("unimplemented") } // TODO: methods for @@ -308,52 +174,25 @@ func (r *Run) Bytes() []byte { // Direction reports the direction of the run. func (r *Run) Direction() Direction { - return r.direction + panic("unimplemented") } -// Pos returns the position of the Run within the text passed to SetBytes or SetString of the +// Position of the Run within the text passed to SetBytes or SetString of the // originating Paragraph value. func (r *Run) Pos() (start, end int) { - return r.startpos, r.startpos + len(r.runes) - 1 + panic("unimplemented") } // AppendReverse reverses the order of characters of in, appends them to out, // and returns the result. Modifiers will still follow the runes they modify. // Brackets are replaced with their counterparts. func AppendReverse(out, in []byte) []byte { - ret := make([]byte, len(in)+len(out)) - copy(ret, out) - inRunes := bytes.Runes(in) - - for i, r := range inRunes { - prop, _ := LookupRune(r) - if prop.IsBracket() { - inRunes[i] = prop.reverseBracket(r) - } - } - - for i, j := 0, len(inRunes)-1; i < j; i, j = i+1, j-1 { - inRunes[i], inRunes[j] = inRunes[j], inRunes[i] - } - copy(ret[len(out):], string(inRunes)) - - return ret + panic("unimplemented") } // ReverseString reverses the order of characters in s and returns a new string. // Modifiers will still follow the runes they modify. Brackets are replaced with // their counterparts. func ReverseString(s string) string { - input := []rune(s) - li := len(input) - ret := make([]rune, li) - for i, r := range input { - prop, _ := LookupRune(r) - if prop.IsBracket() { - ret[li-i-1] = prop.reverseBracket(r) - } else { - ret[li-i-1] = r - } - } - return string(ret) + panic("unimplemented") } diff --git a/test/vendor/golang.org/x/text/unicode/bidi/core.go b/test/vendor/golang.org/x/text/unicode/bidi/core.go index e4c0811016..50deb6600a 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/core.go @@ -4,10 +4,7 @@ package bidi -import ( - "fmt" - "log" -) +import "log" // This implementation is a port based on the reference implementation found at: // https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/ @@ -100,20 +97,13 @@ type paragraph struct { // rune (suggested is the rune of the open bracket for opening and matching // close brackets, after normalization). The embedding levels are optional, but // may be supplied to encode embedding levels of styled text. -func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, levels level) (*paragraph, error) { - var err error - if err = validateTypes(types); err != nil { - return nil, err - } - if err = validatePbTypes(pairTypes); err != nil { - return nil, err - } - if err = validatePbValues(pairValues, pairTypes); err != nil { - return nil, err - } - if err = validateParagraphEmbeddingLevel(levels); err != nil { - return nil, err - } +// +// TODO: return an error. +func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, levels level) *paragraph { + validateTypes(types) + validatePbTypes(pairTypes) + validatePbValues(pairValues, pairTypes) + validateParagraphEmbeddingLevel(levels) p := ¶graph{ initialTypes: append([]Class(nil), types...), @@ -125,7 +115,7 @@ func newParagraph(types []Class, pairTypes []bracketType, pairValues []rune, lev resultTypes: append([]Class(nil), types...), } p.run() - return p, nil + return p } func (p *paragraph) Len() int { return len(p.initialTypes) } @@ -1011,61 +1001,58 @@ func typeForLevel(level level) Class { return R } -func validateTypes(types []Class) error { +// TODO: change validation to not panic + +func validateTypes(types []Class) { if len(types) == 0 { - return fmt.Errorf("types is null") + log.Panic("types is null") } for i, t := range types[:len(types)-1] { if t == B { - return fmt.Errorf("B type before end of paragraph at index: %d", i) + log.Panicf("B type before end of paragraph at index: %d", i) } } - return nil } -func validateParagraphEmbeddingLevel(embeddingLevel level) error { +func validateParagraphEmbeddingLevel(embeddingLevel level) { if embeddingLevel != implicitLevel && embeddingLevel != 0 && embeddingLevel != 1 { - return fmt.Errorf("illegal paragraph embedding level: %d", embeddingLevel) + log.Panicf("illegal paragraph embedding level: %d", embeddingLevel) } - return nil } -func validateLineBreaks(linebreaks []int, textLength int) error { +func validateLineBreaks(linebreaks []int, textLength int) { prev := 0 for i, next := range linebreaks { if next <= prev { - return fmt.Errorf("bad linebreak: %d at index: %d", next, i) + log.Panicf("bad linebreak: %d at index: %d", next, i) } prev = next } if prev != textLength { - return fmt.Errorf("last linebreak was %d, want %d", prev, textLength) + log.Panicf("last linebreak was %d, want %d", prev, textLength) } - return nil } -func validatePbTypes(pairTypes []bracketType) error { +func validatePbTypes(pairTypes []bracketType) { if len(pairTypes) == 0 { - return fmt.Errorf("pairTypes is null") + log.Panic("pairTypes is null") } for i, pt := range pairTypes { switch pt { case bpNone, bpOpen, bpClose: default: - return fmt.Errorf("illegal pairType value at %d: %v", i, pairTypes[i]) + log.Panicf("illegal pairType value at %d: %v", i, pairTypes[i]) } } - return nil } -func validatePbValues(pairValues []rune, pairTypes []bracketType) error { +func validatePbValues(pairValues []rune, pairTypes []bracketType) { if pairValues == nil { - return fmt.Errorf("pairValues is null") + log.Panic("pairValues is null") } if len(pairTypes) != len(pairValues) { - return fmt.Errorf("pairTypes is different length from pairValues") + log.Panic("pairTypes is different length from pairValues") } - return nil } diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go index 42fa8d72ce..d8c94e1bd1 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go index 56a0e1ea21..16b11db538 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go index baacf32b43..647f2d4279 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go index f248effae1..c937d0976f 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.16 // +build go1.16 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go b/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go index f517fdb202..0ca0193ebe 100644 --- a/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package bidi diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index f5a0788277..26fbd55a12 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go index cb7239c437..2c58f09baa 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go index 11b2733001..7e1ae096e5 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go index 96a130d30e..9ea1b42140 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build go1.16 // +build go1.16 package norm diff --git a/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 0175eae50a..9429069291 100644 --- a/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/test/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -1,6 +1,5 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -//go:build !go1.10 // +build !go1.10 package norm diff --git a/test/vendor/modules.txt b/test/vendor/modules.txt index 1cf0218fda..cb8f330aeb 100644 --- a/test/vendor/modules.txt +++ b/test/vendor/modules.txt @@ -6,7 +6,7 @@ github.com/Microsoft/go-winio/pkg/guid github.com/Microsoft/go-winio/pkg/process github.com/Microsoft/go-winio/pkg/security github.com/Microsoft/go-winio/vhd -# github.com/Microsoft/hcsshim v0.8.23 => ../ +# github.com/Microsoft/hcsshim v0.9.1 => ../ ## explicit github.com/Microsoft/hcsshim github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options @@ -242,7 +242,7 @@ go.opencensus.io/trace go.opencensus.io/trace/internal go.opencensus.io/trace/propagation go.opencensus.io/trace/tracestate -# golang.org/x/net v0.0.0-20210825183410-e898025ed96a +# golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 golang.org/x/net/context/ctxhttp golang.org/x/net/http/httpguts golang.org/x/net/http2 @@ -262,7 +262,7 @@ golang.org/x/sys/windows golang.org/x/sys/windows/registry golang.org/x/sys/windows/svc golang.org/x/sys/windows/svc/mgr -# golang.org/x/text v0.3.6 +# golang.org/x/text v0.3.4 golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi diff --git a/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go new file mode 100644 index 0000000000..38dc837c6e --- /dev/null +++ b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/manifest.go @@ -0,0 +1,4 @@ +package manifest + +// This is so that tests can include the .syso to manifest them to pick up the right Windows build +// TODO: Auto-generation of the .syso through rsrc or similar. diff --git a/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso b/vendor/github.com/Microsoft/hcsshim/test/testutil/manifest/rsrc_amd64.syso new file mode 100644 index 0000000000000000000000000000000000000000..0e9857245ba25586643b662700494e852cfe75ec GIT binary patch literal 372470 zcmeEP2Y405+TL?cLa|{7mEKY8QWWpi`+Kb@7O-FSdhNaU0v4oqkzQ0ldQU=40)fyw z>6PBAs0bwUzwex#WOH)T6G-{a^Sqhao!!~l_bcnA6yoHsZ#?jZ!W;P=KT-e ze?jl{{<$4xw<7x`QvS{YZnv%rXFl^6XnC;F+Oj&GjkJo(>U18rk)DtARirhL4n~T^ z@vEe-`zg+IV{c!itY3(>`!&#dHM2Tv@Na?E`I*&O}tw=CD#Pc8S1?=4SAH!EO%FDqbSA1ffdpA``CqvcuhljVsVWVx3Ow#0W7 zgjhLN7$_nGQQ;rD;?@p#CCAKk$F1n$iCfh_ASr5k!0zAo=EufePr5C4H_Hkbb*&XR zzJpb1RBJ1+r^gC-*Rnh}Rkqw~*XQ4+r+;g?=5+V^hS0uNKv+M^13%%0zi=%YV7ZnK z%70x&q(x2_2Ffi1F-yL3$F2D(FganNC#RcS+|vqJHKy@Z>t{c5*QU@9+Q%&K{ba(X z@lPa0Pk$kPRsWu`%ezjEiTo}!CbILg*kxVT#w_a^6|=m1e9Y3$(b%^xZbi>E@vHi* zSTp^h1z~+X!x#3px-aPE`gm>+>%Xw)Ct%-?Ego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fm+IxCBxjKxWra%I2p1qWlJluMCj``Zj)!tL(>N3W|-P7IKOEt#bwTHc@Yv;+9 zN`*CU}93-u>LijC1nn*`=bNHX72KVDIJP;4T3x!IhWt0Nx>ghRY z!UT5@FDJ(VLlpfTdnsqwI$1b(x3}!7a&UIAQdv7Y*{U4u>}^!mw$6?=7WS4l_ICE( z$}W}DshE*%XUm%8Wa-?kd$%#&yQyp~oGew=U9Id?b~X+UDqAZ@3+HZ*7LNAaZJ&|T zFc%bRP4aT;YGG+_U5ob9ZhslJ-zV{PBnxvQ;{mCDA-!A@mu zZEdM?u(unda_na3Xl-w8-_6OYlJa_Xsivaz?DAOMq88CbY7!W^Iil?f<-&zBS6-Rx rewoXFe>A?pqcwaziP?P>Yq#EJ> literal 0 HcmV?d00001 diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go index 4e6c4b2362..82da6c6a89 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/index.go @@ -21,6 +21,9 @@ import "github.com/opencontainers/image-spec/specs-go" type Index struct { specs.Versioned + // MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json` + MediaType string `json:"mediaType,omitempty"` + // Manifests references platform specific manifests. Manifests []Descriptor `json:"manifests"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go index 7ff32c40ba..d72d15ce4b 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/manifest.go @@ -20,6 +20,9 @@ import "github.com/opencontainers/image-spec/specs-go" type Manifest struct { specs.Versioned + // MediaType specificies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json` + MediaType string `json:"mediaType,omitempty"` + // Config references a configuration object for a container, by digest. // The referenced configuration object is a JSON blob that the runtime uses to set up the container. Config Descriptor `json:"config"` diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index 5d493df233..0d9543f160 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -22,7 +22,7 @@ const ( // VersionMinor is for functionality in a backwards-compatible manner VersionMinor = 0 // VersionPatch is for backwards-compatible bug fixes - VersionPatch = 1 + VersionPatch = 2 // VersionDev indicates development branch. Releases will be empty string. VersionDev = "" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9ee12f8ef4..fa4e850327 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,6 +9,8 @@ github.com/Microsoft/go-winio/pkg/guid github.com/Microsoft/go-winio/pkg/process github.com/Microsoft/go-winio/pkg/security github.com/Microsoft/go-winio/vhd +# github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3 => ./test +github.com/Microsoft/hcsshim/test/testutil/manifest # github.com/cenkalti/backoff/v4 v4.1.1 github.com/cenkalti/backoff/v4 # github.com/containerd/cgroups v1.0.1 @@ -113,7 +115,7 @@ github.com/mattn/go-shellwords github.com/moby/sys/mountinfo # github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/go-digest -# github.com/opencontainers/image-spec v1.0.1 +# github.com/opencontainers/image-spec v1.0.2 github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 # github.com/opencontainers/runc v1.0.2 From 31048920f8d6f691b191e2b9224a9eb3e8b0b91a Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy Date: Thu, 6 Jan 2022 10:39:44 -0500 Subject: [PATCH 5/5] PR feedback: name changes and code cleanup Signed-off-by: Hamza El-Saawy --- internal/schemaversion/schemaversion_test.go | 4 ++- test/functional/main_test.go | 33 +++++++++++--------- test/functional/uvm_cpulimits_test.go | 6 ++-- test/runhcs/e2e_matrix_test.go | 4 +-- test/testutil/constants.go | 6 ++-- test/testutil/containerd.go | 6 ++-- test/testutil/ctrclient.go | 11 ++++--- 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/internal/schemaversion/schemaversion_test.go b/internal/schemaversion/schemaversion_test.go index 3ea75db01c..e55e2955b8 100644 --- a/internal/schemaversion/schemaversion_test.go +++ b/internal/schemaversion/schemaversion_test.go @@ -6,8 +6,10 @@ import ( hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/testutil/manifest" "github.com/sirupsen/logrus" + + // import solely for side-effect; maifest allows access to os version + _ "github.com/Microsoft/hcsshim/test/testutil/manifest" ) func init() { diff --git a/test/functional/main_test.go b/test/functional/main_test.go index 4ccf2c50d1..1d5013ebed 100644 --- a/test/functional/main_test.go +++ b/test/functional/main_test.go @@ -29,17 +29,20 @@ var ( // flags flagContainerdAddress = flag.String("ctr-address", "tcp://127.0.0.1:2376", "Address for containerd's GRPC server") flagContainerdNamespace = flag.String("ctr-namespace", "k8s.io", "Containerd namespace") - flagCtrPath = flag.String("ctr-path", testutil.DefaultCtrPath(), "Path to ctr.exe") + flagCtrExePath = flag.String("ctr-path", testutil.DefaultCtrPath(), "Path to ctr.exe") flagLinuxBootFilesPath = flag.String("linux-bootfiles", "C:\\ContainerPlat\\LinuxBootFiles", "Path to LCOW UVM boot files (rootfs.vhd, initrd.img, kernel, etc.)") ) +// todo: use separate containerd namespace for testing, pull images and create commit snapshots for +// images as needed, then remove all active and view snapshots at the end in cleanup + func init() { - if len(os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG")) > 0 { + if _, ok := os.LookupEnv("HCSSHIM_FUNCTIONAL_TESTS_DEBUG"); ok { debug = true } - flag.BoolVar(&debug, "debug", debug, "Set logging level to debug [%%HCSSHIM_FUNCTIONAL_TESTS_DEBUG%%]") + flag.BoolVar(&debug, "debug", debug, "Set logging level to debug [%HCSSHIM_FUNCTIONAL_TESTS_DEBUG%]") // This allows for debugging a utility VM. if s := os.Getenv("HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES"); s != "" { @@ -51,17 +54,19 @@ func init() { "container-creation-failure-pause", pauseDurationOnCreateContainerFailure, "The number of minutes to wait after a container creation failure to try again "+ - "[%%HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES%%]") + "[%HCSSHIM_FUNCTIONAL_TESTS_PAUSE_ON_CREATECONTAINER_FAIL_IN_MINUTES%]") + lvl := logrus.WarnLevel if debug { - logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) + lvl = logrus.DebugLevel } + // logrus.SetOutput(ioutil.Discard) + logrus.SetLevel(lvl) + logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) // Try to stop any pre-existing compute processes cmd := exec.Command("powershell", `get-computeprocess | stop-computeprocess -force`) _ = cmd.Run() - } func TestMain(m *testing.M) { @@ -86,13 +91,13 @@ func CreateContainerTestWrapper(ctx context.Context, options *hcsoci.CreateOptio func getCtrOptions() testutil.CtrClientOptions { return testutil.CtrClientOptions{ - Ctrd: getCtrdOptions(), - Path: *flagLinuxBootFilesPath, + Ctrd: getContainerdOptions(), + Path: *flagCtrExePath, } } -func getCtrdOptions() testutil.CtrdClientOptions { - return testutil.CtrdClientOptions{ +func getContainerdOptions() testutil.ContainerdClientOptions { + return testutil.ContainerdClientOptions{ Address: *flagContainerdAddress, Namespace: *flagContainerdNamespace, } @@ -114,9 +119,9 @@ func getDefaultWCOWUvmOptions(t *testing.T, name string) *uvm.OptionsWCOW { // convenience wrappers func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { - return getCtrdOptions().NewClient(ctx, t) + return getContainerdOptions().NewClient(ctx, t) } -func pullImage(ctx context.Context, t *testing.T, snapshotter, image string) { - getCtrOptions().PullImage(ctx, t, snapshotter, image) +func pullImage(ctx context.Context, t *testing.T, platform, image string) { + getCtrOptions().PullImage(ctx, t, platform, image) } diff --git a/test/functional/uvm_cpulimits_test.go b/test/functional/uvm_cpulimits_test.go index 85580c5c88..7db2a285fb 100644 --- a/test/functional/uvm_cpulimits_test.go +++ b/test/functional/uvm_cpulimits_test.go @@ -32,14 +32,14 @@ func TestUVMCPULimitsUpdateWCOW(t *testing.T) { testutil.RequiresBuild(t, osversion.RS5) client, ctx := newCtrdClient(context.Background(), t) - ctx, cancel := context.WithTimeout(ctx, 40*time.Second) - defer cancel() - opts := getDefaultWCOWUvmOptions(t, t.Name()) opts.MemorySizeInMB = 1024 * 2 + // context with time out times out and prevents this from cleaning up and removing snapshots u, _, _ := testutil.CreateWCOWUVMFromOptsWithImage(ctx, t, client, opts, testutil.ImageWindowsNanoserver2004) + ctx, cancel := context.WithTimeout(ctx, 40*time.Second) + defer cancel() limits := &hcsschema.ProcessorLimits{ Weight: 10000, } diff --git a/test/runhcs/e2e_matrix_test.go b/test/runhcs/e2e_matrix_test.go index d2ed8acbba..7d9e408b57 100644 --- a/test/runhcs/e2e_matrix_test.go +++ b/test/runhcs/e2e_matrix_test.go @@ -165,7 +165,7 @@ func readPidFile(path string) (int, error) { } func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, context.Context) { - cdo := testutil.CtrdClientOptions{ + cdo := testutil.ContainerdClientOptions{ Address: "tcp://127.0.0.1:2376", Namespace: "k8s.io", } @@ -175,7 +175,7 @@ func newCtrdClient(ctx context.Context, t *testing.T) (*containerd.Client, conte func pullImage(ctx context.Context, t *testing.T, snapshotter, image string) { co := testutil.CtrClientOptions{ - Ctrd: testutil.CtrdClientOptions{ + Ctrd: testutil.ContainerdClientOptions{ Address: "tcp://127.0.0.1:2376", Namespace: "k8s.io", }, diff --git a/test/testutil/constants.go b/test/testutil/constants.go index a33d5c2da3..a2dfe47c4f 100644 --- a/test/testutil/constants.go +++ b/test/testutil/constants.go @@ -5,8 +5,6 @@ import ( "time" ) -// TODO: move these somewhere common for all tests (functional, cri-containerd, etc.) - const ( connectTimeout = time.Second * 10 @@ -30,8 +28,8 @@ var ( ImageWindowsNanoserver2009 = NanoserverImage("2009") ImageWindowsNanoserverLTSC2022 = NanoserverImage("ltsc2022") - ImageWindowsServercore1709 = NanoserverImage("1709") - ImageWindowsServercore1803 = NanoserverImage("1803") + ImageWindowsServercore1709 = ServercoreImage("1709") + ImageWindowsServercore1803 = ServercoreImage("1803") ImageWindowsServercore1809 = ServercoreImage("1809") ImageWindowsServercore1903 = ServercoreImage("1903") ImageWindowsServercore1909 = ServercoreImage("1909") diff --git a/test/testutil/containerd.go b/test/testutil/containerd.go index bf9e8f4ede..6753daa171 100644 --- a/test/testutil/containerd.go +++ b/test/testutil/containerd.go @@ -23,17 +23,17 @@ func createGRPCConn(ctx context.Context, address string) (*grpc.ClientConn, erro return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer(dialer)) } -type CtrdClientOptions struct { +type ContainerdClientOptions struct { Address string Namespace string } -func (cco CtrdClientOptions) defaultOpts() []containerd.ClientOpt { +func (cco ContainerdClientOptions) defaultOpts() []containerd.ClientOpt { return []containerd.ClientOpt{containerd.WithDefaultNamespace(cco.Namespace)} } // returned context is how namespaces are passed to various containerd client calls -func (cco CtrdClientOptions) NewClient(ctx context.Context, t *testing.T, opts ...containerd.ClientOpt) (*containerd.Client, context.Context) { +func (cco ContainerdClientOptions) NewClient(ctx context.Context, t *testing.T, opts ...containerd.ClientOpt) (*containerd.Client, context.Context) { // regular `New` does not work on windows, need to use `WithConn` cctx, ccancel := context.WithTimeout(ctx, connectTimeout) defer ccancel() diff --git a/test/testutil/ctrclient.go b/test/testutil/ctrclient.go index ddf4e358b8..aa4ed58cab 100644 --- a/test/testutil/ctrclient.go +++ b/test/testutil/ctrclient.go @@ -18,7 +18,7 @@ func DefaultCtrPath() string { // or move `utilities/*` into parent path, similar to `tests/cri-containerd` type CtrClientOptions struct { - Ctrd CtrdClientOptions + Ctrd ContainerdClientOptions Path string } @@ -34,12 +34,13 @@ func (co CtrClientOptions) Command(ctx context.Context, arg ...string) *exec.Cmd return cmd } -func (co CtrClientOptions) PullImage(ctx context.Context, t *testing.T, snapshotter, image string) { +// PullImages fetches the image, unpacks, and creates a snapshot of it using the chain ID as +// the reference. Rather than reimplement that using a containerd client, leverage ctr.exe +func (co CtrClientOptions) PullImage(ctx context.Context, t *testing.T, platform, image string) { cmd := co.Command(ctx, "images", "pull", - "--snapshotter", - snapshotter, - "view", + "--platform", + platform, image) if err := cmd.Run(); err != nil { t.Fatalf("Failed to pull image %q with %v. Command was %v", image, err, cmd)