diff --git a/test/cri-containerd/clone_test.go b/test/cri-containerd/clone_test.go index 9074ef77ff..07656db9ea 100644 --- a/test/cri-containerd/clone_test.go +++ b/test/cri-containerd/clone_test.go @@ -14,7 +14,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/container_bench_test.go b/test/cri-containerd/container_bench_test.go index 5fa1e69303..cd3e1985e0 100644 --- a/test/cri-containerd/container_bench_test.go +++ b/test/cri-containerd/container_bench_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" ) var _containerBenchmarkTests = []struct { diff --git a/test/cri-containerd/container_downlevel_test.go b/test/cri-containerd/container_downlevel_test.go index d9f5e748bb..fd7a077d65 100644 --- a/test/cri-containerd/container_downlevel_test.go +++ b/test/cri-containerd/container_downlevel_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/container_fileshare_test.go b/test/cri-containerd/container_fileshare_test.go index 9ad13fe55a..6b70157f87 100644 --- a/test/cri-containerd/container_fileshare_test.go +++ b/test/cri-containerd/container_fileshare_test.go @@ -11,8 +11,8 @@ import ( "strings" "testing" - "github.com/Microsoft/hcsshim/internal/hcs" "github.com/Microsoft/hcsshim/pkg/annotations" + "github.com/Microsoft/hcsshim/test/pkg/definitions/hcs" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/container_gmsa_test.go b/test/cri-containerd/container_gmsa_test.go index ef9fe22701..14be0d585b 100644 --- a/test/cri-containerd/container_gmsa_test.go +++ b/test/cri-containerd/container_gmsa_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/Microsoft/hcsshim/internal/hcs" "github.com/Microsoft/hcsshim/pkg/annotations" + "github.com/Microsoft/hcsshim/test/pkg/definitions/hcs" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/container_layers_packing_test.go b/test/cri-containerd/container_layers_packing_test.go index ad5183c31a..ace5872e24 100644 --- a/test/cri-containerd/container_layers_packing_test.go +++ b/test/cri-containerd/container_layers_packing_test.go @@ -11,7 +11,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" ) const ( diff --git a/test/cri-containerd/container_test.go b/test/cri-containerd/container_test.go index 8fbf9ee295..118440a63e 100644 --- a/test/cri-containerd/container_test.go +++ b/test/cri-containerd/container_test.go @@ -18,8 +18,8 @@ import ( "github.com/sirupsen/logrus" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" - "github.com/Microsoft/hcsshim/internal/guestpath" "github.com/Microsoft/hcsshim/pkg/annotations" + "github.com/Microsoft/hcsshim/test/pkg/definitions/guestpath" ) func runLogRotationContainer(t *testing.T, sandboxRequest *runtime.RunPodSandboxRequest, request *runtime.CreateContainerRequest, log string, logArchive string) { diff --git a/test/cri-containerd/container_update_test.go b/test/cri-containerd/container_update_test.go index e23aba652a..53939a0021 100644 --- a/test/cri-containerd/container_update_test.go +++ b/test/cri-containerd/container_update_test.go @@ -11,7 +11,7 @@ import ( "github.com/Microsoft/hcsshim/internal/memory" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/createcontainer_test.go b/test/cri-containerd/createcontainer_test.go index 7e70489ada..3815d92253 100644 --- a/test/cri-containerd/createcontainer_test.go +++ b/test/cri-containerd/createcontainer_test.go @@ -14,7 +14,7 @@ import ( "github.com/Microsoft/hcsshim/internal/memory" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/extended_task_test.go b/test/cri-containerd/extended_task_test.go index 214f718dc0..87c8772fcb 100644 --- a/test/cri-containerd/extended_task_test.go +++ b/test/cri-containerd/extended_task_test.go @@ -8,9 +8,9 @@ import ( "fmt" "testing" - "github.com/Microsoft/hcsshim/internal/extendedtask" - "github.com/Microsoft/hcsshim/internal/shimdiag" "github.com/Microsoft/hcsshim/pkg/annotations" + "github.com/Microsoft/hcsshim/test/pkg/definitions/extendedtask" + "github.com/Microsoft/hcsshim/test/pkg/definitions/shimdiag" ) func getPodProcessorInfo(ctx context.Context, podID string) (*extendedtask.ComputeProcessorInfoResponse, error) { diff --git a/test/cri-containerd/helper_exec_test.go b/test/cri-containerd/helper_exec_test.go index e250b4c03b..e0a76e0f78 100644 --- a/test/cri-containerd/helper_exec_test.go +++ b/test/cri-containerd/helper_exec_test.go @@ -12,8 +12,8 @@ import ( "strings" "testing" - "github.com/Microsoft/hcsshim/internal/cmd" - "github.com/Microsoft/hcsshim/internal/shimdiag" + "github.com/Microsoft/hcsshim/test/pkg/definitions/cmd" + "github.com/Microsoft/hcsshim/test/pkg/definitions/shimdiag" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/helper_share_test.go b/test/cri-containerd/helper_share_test.go index a3be151988..e58bc7cef5 100644 --- a/test/cri-containerd/helper_share_test.go +++ b/test/cri-containerd/helper_share_test.go @@ -6,7 +6,7 @@ package cri_containerd import ( "context" - "github.com/Microsoft/hcsshim/internal/shimdiag" + "github.com/Microsoft/hcsshim/test/pkg/definitions/shimdiag" ) func shareInUVM(ctx context.Context, client shimdiag.ShimDiagService, hostPath, uvmPath string, readOnly bool) error { diff --git a/test/cri-containerd/helper_update_utilities_test.go b/test/cri-containerd/helper_update_utilities_test.go index de4756fea6..7c3cc5e5ad 100644 --- a/test/cri-containerd/helper_update_utilities_test.go +++ b/test/cri-containerd/helper_update_utilities_test.go @@ -11,7 +11,7 @@ import ( "strings" "testing" - "github.com/Microsoft/hcsshim/internal/shimdiag" + "github.com/Microsoft/hcsshim/test/pkg/definitions/shimdiag" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/jobcontainer_test.go b/test/cri-containerd/jobcontainer_test.go index 103fff4149..ec5e0fd64f 100644 --- a/test/cri-containerd/jobcontainer_test.go +++ b/test/cri-containerd/jobcontainer_test.go @@ -18,10 +18,10 @@ import ( runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" "github.com/Microsoft/hcsshim/hcn" - "github.com/Microsoft/hcsshim/internal/winapi" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/definitions/winapi" + "github.com/Microsoft/hcsshim/test/pkg/require" ) func getJobContainerPodRequestWCOW(t *testing.T) *runtime.RunPodSandboxRequest { diff --git a/test/cri-containerd/main_test.go b/test/cri-containerd/main_test.go index 0687cb5be1..c4a18998eb 100644 --- a/test/cri-containerd/main_test.go +++ b/test/cri-containerd/main_test.go @@ -24,11 +24,11 @@ import ( "google.golang.org/grpc" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" - "github.com/Microsoft/hcsshim/test/internal/constants" - testflag "github.com/Microsoft/hcsshim/test/internal/flag" - "github.com/Microsoft/hcsshim/test/internal/require" + testflag "github.com/Microsoft/hcsshim/test/pkg/flag" + "github.com/Microsoft/hcsshim/test/pkg/images" + "github.com/Microsoft/hcsshim/test/pkg/require" - _ "github.com/Microsoft/hcsshim/test/internal/manifest" + _ "github.com/Microsoft/hcsshim/test/pkg/manifest" ) const ( @@ -84,12 +84,12 @@ const ( var ( imageWindowsNanoserver = getWindowsNanoserverImage(osversion.Build()) imageWindowsServercore = getWindowsServerCoreImage(osversion.Build()) - imageWindowsNanoserver17763 = constants.ImageWindowsNanoserver1809 - imageWindowsNanoserver18362 = constants.ImageWindowsNanoserver1903 - imageWindowsNanoserver19041 = constants.ImageWindowsNanoserver2004 - imageWindowsServercore17763 = constants.ImageWindowsServercore1809 - imageWindowsServercore18362 = constants.ImageWindowsServercore1903 - imageWindowsServercore19041 = constants.ImageWindowsServercore2004 + imageWindowsNanoserver17763 = images.ImageWindowsNanoserver1809 + imageWindowsNanoserver18362 = images.ImageWindowsNanoserver1903 + imageWindowsNanoserver19041 = images.ImageWindowsNanoserver2004 + imageWindowsServercore17763 = images.ImageWindowsServercore1809 + imageWindowsServercore18362 = images.ImageWindowsServercore1903 + imageWindowsServercore19041 = images.ImageWindowsServercore2004 ) // Flags @@ -165,20 +165,20 @@ func requireBinary(tb testing.TB, binary string) string { } func getWindowsNanoserverImage(build uint16) string { - tag, err := constants.ImageFromBuild(build) + tag, err := images.ImageFromBuild(build) if err != nil { panic(err) } - return constants.NanoserverImage(tag) + return images.NanoserverImage(tag) } //nolint:unused // may be used in future tests func getWindowsServerCoreImage(build uint16) string { - tag, err := constants.ImageFromBuild(build) + tag, err := images.ImageFromBuild(build) if err != nil { panic(err) } - return constants.ServercoreImage(tag) + return images.ServercoreImage(tag) } func createGRPCConn(ctx context.Context) (*grpc.ClientConn, error) { diff --git a/test/cri-containerd/pod_update_test.go b/test/cri-containerd/pod_update_test.go index 9fe2286b7c..6cb541ebc1 100644 --- a/test/cri-containerd/pod_update_test.go +++ b/test/cri-containerd/pod_update_test.go @@ -8,10 +8,10 @@ import ( "fmt" "testing" - "github.com/Microsoft/hcsshim/internal/cpugroup" "github.com/Microsoft/hcsshim/internal/memory" - "github.com/Microsoft/hcsshim/internal/processorinfo" "github.com/Microsoft/hcsshim/pkg/annotations" + "github.com/Microsoft/hcsshim/test/pkg/definitions/cpugroup" + "github.com/Microsoft/hcsshim/test/pkg/definitions/processorinfo" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/cri-containerd/policy_test.go b/test/cri-containerd/policy_test.go index 4b453be04a..6ca2aa613e 100644 --- a/test/cri-containerd/policy_test.go +++ b/test/cri-containerd/policy_test.go @@ -17,9 +17,9 @@ import ( runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" - "github.com/Microsoft/hcsshim/internal/tools/securitypolicy/helpers" "github.com/Microsoft/hcsshim/pkg/annotations" "github.com/Microsoft/hcsshim/pkg/securitypolicy" + "github.com/Microsoft/hcsshim/test/pkg/definitions/tools/securitypolicy/helpers" ) var validPolicyAlpineCommand = []string{"ash", "-c", "echo 'Hello'"} diff --git a/test/cri-containerd/runpodsandbox_test.go b/test/cri-containerd/runpodsandbox_test.go index 94400ba753..2d18980ba0 100644 --- a/test/cri-containerd/runpodsandbox_test.go +++ b/test/cri-containerd/runpodsandbox_test.go @@ -15,15 +15,15 @@ import ( "testing" "time" - "github.com/Microsoft/hcsshim/internal/cpugroup" - "github.com/Microsoft/hcsshim/internal/hcs" - "github.com/Microsoft/hcsshim/internal/lcow" - "github.com/Microsoft/hcsshim/internal/processorinfo" - "github.com/Microsoft/hcsshim/internal/shimdiag" "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/annotations" - "github.com/Microsoft/hcsshim/test/internal/require" - testuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/definitions/cpugroup" + "github.com/Microsoft/hcsshim/test/pkg/definitions/hcs" + "github.com/Microsoft/hcsshim/test/pkg/definitions/lcow" + "github.com/Microsoft/hcsshim/test/pkg/definitions/processorinfo" + "github.com/Microsoft/hcsshim/test/pkg/definitions/shimdiag" + "github.com/Microsoft/hcsshim/test/pkg/require" + testuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" "github.com/containerd/containerd/log" "golang.org/x/sys/windows" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" diff --git a/test/cri-containerd/stopcontainer_test.go b/test/cri-containerd/stopcontainer_test.go index d5427fbc95..ec5756659d 100644 --- a/test/cri-containerd/stopcontainer_test.go +++ b/test/cri-containerd/stopcontainer_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) diff --git a/test/functional/lcow_bench_test.go b/test/functional/lcow_bench_test.go index 263fa2d870..21ef75443a 100644 --- a/test/functional/lcow_bench_test.go +++ b/test/functional/lcow_bench_test.go @@ -9,8 +9,8 @@ import ( "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func BenchmarkLCOW_UVM_Create(b *testing.B) { diff --git a/test/functional/lcow_container_bench_test.go b/test/functional/lcow_container_bench_test.go index 26327fceea..4ace2aebba 100644 --- a/test/functional/lcow_container_bench_test.go +++ b/test/functional/lcow_container_bench_test.go @@ -17,8 +17,8 @@ import ( "github.com/Microsoft/hcsshim/test/internal/container" "github.com/Microsoft/hcsshim/test/internal/layers" "github.com/Microsoft/hcsshim/test/internal/oci" - "github.com/Microsoft/hcsshim/test/internal/require" - "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func BenchmarkLCOW_Container(b *testing.B) { diff --git a/test/functional/lcow_container_test.go b/test/functional/lcow_container_test.go index d8b3372098..1e23facd9b 100644 --- a/test/functional/lcow_container_test.go +++ b/test/functional/lcow_container_test.go @@ -15,8 +15,8 @@ import ( "github.com/Microsoft/hcsshim/test/internal/container" "github.com/Microsoft/hcsshim/test/internal/layers" "github.com/Microsoft/hcsshim/test/internal/oci" - "github.com/Microsoft/hcsshim/test/internal/require" - "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func TestLCOW_ContainerLifecycle(t *testing.T) { diff --git a/test/functional/lcow_networking_test.go b/test/functional/lcow_networking_test.go index 608831ddfb..63a61210da 100644 --- a/test/functional/lcow_networking_test.go +++ b/test/functional/lcow_networking_test.go @@ -17,8 +17,8 @@ import ( "github.com/Microsoft/hcsshim/test/internal/container" "github.com/Microsoft/hcsshim/test/internal/layers" "github.com/Microsoft/hcsshim/test/internal/oci" - "github.com/Microsoft/hcsshim/test/internal/require" - "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func TestLCOW_IPv6_Assignment(t *testing.T) { diff --git a/test/functional/lcow_test.go b/test/functional/lcow_test.go index a69af2ba99..b2895d6a65 100644 --- a/test/functional/lcow_test.go +++ b/test/functional/lcow_test.go @@ -24,8 +24,8 @@ import ( testutilities "github.com/Microsoft/hcsshim/test/internal" testcmd "github.com/Microsoft/hcsshim/test/internal/cmd" - "github.com/Microsoft/hcsshim/test/internal/require" - testuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + testuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) // test if waiting after creating (but not starting) an LCOW uVM returns diff --git a/test/functional/main_test.go b/test/functional/main_test.go index 77243cd98c..1a3fe35a7f 100644 --- a/test/functional/main_test.go +++ b/test/functional/main_test.go @@ -29,12 +29,12 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/internal/winapi" - "github.com/Microsoft/hcsshim/test/internal/constants" - testflag "github.com/Microsoft/hcsshim/test/internal/flag" "github.com/Microsoft/hcsshim/test/internal/layers" - "github.com/Microsoft/hcsshim/test/internal/require" "github.com/Microsoft/hcsshim/test/internal/util" - testuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + testflag "github.com/Microsoft/hcsshim/test/pkg/flag" + "github.com/Microsoft/hcsshim/test/pkg/images" + "github.com/Microsoft/hcsshim/test/pkg/require" + testuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) // owner field for uVMs. @@ -42,18 +42,18 @@ const hcsOwner = "hcsshim-functional-tests" var ( alpineImagePaths = &layers.LazyImageLayers{ - Image: constants.ImageLinuxAlpineLatest, - Platform: constants.PlatformLinux, + Image: images.ImageLinuxAlpineLatest, + Platform: images.PlatformLinux, } //TODO: pick appropriate image based on OS build nanoserverImagePaths = &layers.LazyImageLayers{ - Image: constants.ImageWindowsNanoserverLTSC2022, - Platform: constants.PlatformWindows, + Image: images.ImageWindowsNanoserverLTSC2022, + Platform: images.PlatformWindows, } // wcow tests originally used busyboxw; cannot find image on docker or mcr servercoreImagePaths = &layers.LazyImageLayers{ - Image: constants.ImageWindowsServercoreLTSC2022, - Platform: constants.PlatformWindows, + Image: images.ImageWindowsServercoreLTSC2022, + Platform: images.PlatformWindows, } ) diff --git a/test/functional/uvm_mem_backingtype_test.go b/test/functional/uvm_mem_backingtype_test.go index 45fb88b56f..5839d099e4 100644 --- a/test/functional/uvm_mem_backingtype_test.go +++ b/test/functional/uvm_mem_backingtype_test.go @@ -11,10 +11,10 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" "github.com/sirupsen/logrus" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func runMemStartLCOWTest(t *testing.T, opts *uvm.OptionsLCOW) { diff --git a/test/functional/uvm_memory_test.go b/test/functional/uvm_memory_test.go index 748ddde8f6..c2ec1c71e0 100644 --- a/test/functional/uvm_memory_test.go +++ b/test/functional/uvm_memory_test.go @@ -11,8 +11,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func TestUVMMemoryUpdateLCOW(t *testing.T) { diff --git a/test/functional/uvm_plannine_test.go b/test/functional/uvm_plannine_test.go index 9ea9452aeb..7f5c13c2bf 100644 --- a/test/functional/uvm_plannine_test.go +++ b/test/functional/uvm_plannine_test.go @@ -16,8 +16,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - testuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + testuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) // TestPlan9 tests adding/removing Plan9 shares to/from a v2 Linux utility VM diff --git a/test/functional/uvm_properties_test.go b/test/functional/uvm_properties_test.go index 5bf784ddc5..b9c74887c2 100644 --- a/test/functional/uvm_properties_test.go +++ b/test/functional/uvm_properties_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func TestPropertiesGuestConnection_LCOW(t *testing.T) { diff --git a/test/functional/uvm_scratch_test.go b/test/functional/uvm_scratch_test.go index bd3d7b07fe..5787595642 100644 --- a/test/functional/uvm_scratch_test.go +++ b/test/functional/uvm_scratch_test.go @@ -13,8 +13,8 @@ import ( "github.com/Microsoft/hcsshim/internal/lcow" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func TestScratchCreateLCOW(t *testing.T) { diff --git a/test/functional/uvm_scsi_test.go b/test/functional/uvm_scsi_test.go index be5a6eade1..737213657c 100644 --- a/test/functional/uvm_scsi_test.go +++ b/test/functional/uvm_scsi_test.go @@ -20,8 +20,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" testutilities "github.com/Microsoft/hcsshim/test/internal" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" "github.com/sirupsen/logrus" ) diff --git a/test/functional/uvm_update_test.go b/test/functional/uvm_update_test.go index e7f2bbb6c0..3df2202117 100644 --- a/test/functional/uvm_update_test.go +++ b/test/functional/uvm_update_test.go @@ -13,8 +13,8 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/Microsoft/hcsshim/pkg/ctrdtaskapi" - "github.com/Microsoft/hcsshim/test/internal/require" - "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + "github.com/Microsoft/hcsshim/test/pkg/uvm" ) func Test_LCOW_Update_Resources(t *testing.T) { diff --git a/test/functional/uvm_virtualdevice_test.go b/test/functional/uvm_virtualdevice_test.go index 59c6c581c8..4b043fdc36 100644 --- a/test/functional/uvm_virtualdevice_test.go +++ b/test/functional/uvm_virtualdevice_test.go @@ -12,8 +12,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) const lcowGPUBootFilesPath = "C:\\ContainerPlat\\LinuxBootFiles\\nvidiagpu" diff --git a/test/functional/uvm_vpmem_test.go b/test/functional/uvm_vpmem_test.go index efc3303010..70b6118e5b 100644 --- a/test/functional/uvm_vpmem_test.go +++ b/test/functional/uvm_vpmem_test.go @@ -12,8 +12,8 @@ import ( "github.com/Microsoft/hcsshim/internal/copyfile" "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) // TestVPMEM tests adding/removing VPMem Read-Only layers from a v2 Linux utility VM diff --git a/test/functional/uvm_vsmb_test.go b/test/functional/uvm_vsmb_test.go index 56da116286..9c037603b5 100644 --- a/test/functional/uvm_vsmb_test.go +++ b/test/functional/uvm_vsmb_test.go @@ -13,8 +13,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + "github.com/Microsoft/hcsshim/test/pkg/require" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) // TestVSMB tests adding/removing VSMB layers from a v2 Windows utility VM diff --git a/test/functional/wcow_test.go b/test/functional/wcow_test.go index b578a345cb..de42540b5b 100644 --- a/test/functional/wcow_test.go +++ b/test/functional/wcow_test.go @@ -27,7 +27,7 @@ import ( "github.com/Microsoft/hcsshim/internal/wcow" "github.com/Microsoft/hcsshim/osversion" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/require" ) // Has testing for Windows containers using both the older hcsshim methods, diff --git a/test/gcs/main_test.go b/test/gcs/main_test.go index bc466a64a3..0e1a415864 100644 --- a/test/gcs/main_test.go +++ b/test/gcs/main_test.go @@ -23,8 +23,8 @@ import ( "github.com/Microsoft/hcsshim/internal/protocol/guestresource" "github.com/Microsoft/hcsshim/pkg/securitypolicy" - testflag "github.com/Microsoft/hcsshim/test/internal/flag" - "github.com/Microsoft/hcsshim/test/internal/require" + testflag "github.com/Microsoft/hcsshim/test/pkg/flag" + "github.com/Microsoft/hcsshim/test/pkg/require" ) const ( diff --git a/test/internal/containerd/containerd.go b/test/internal/containerd/containerd.go index 3f717bee9a..b455b2a525 100644 --- a/test/internal/containerd/containerd.go +++ b/test/internal/containerd/containerd.go @@ -20,8 +20,8 @@ import ( "github.com/opencontainers/image-spec/identity" "google.golang.org/grpc" - "github.com/Microsoft/hcsshim/test/internal/constants" - "github.com/Microsoft/hcsshim/test/internal/timeout" + imagesutil "github.com/Microsoft/hcsshim/test/pkg/images" + "github.com/Microsoft/hcsshim/test/pkg/timeout" ) // images maps image refs -> chain ID @@ -169,7 +169,7 @@ func PullImage(ctx context.Context, tb testing.TB, client *containerd.Client, re containerd.WithPullUnpack, } - if s, err := constants.SnapshotterFromPlatform(plat); err == nil { + if s, err := imagesutil.SnapshotterFromPlatform(plat); err == nil { opts = append(opts, containerd.WithPullSnapshotter(s)) } diff --git a/test/internal/layers/lazy.go b/test/internal/layers/lazy.go index ec4d13c156..119edd7ded 100644 --- a/test/internal/layers/lazy.go +++ b/test/internal/layers/lazy.go @@ -23,8 +23,8 @@ import ( "github.com/Microsoft/hcsshim/internal/wclayer" "github.com/Microsoft/hcsshim/pkg/ociwclayer" - "github.com/Microsoft/hcsshim/test/internal/constants" "github.com/Microsoft/hcsshim/test/internal/util" + "github.com/Microsoft/hcsshim/test/pkg/images" ) // helper utilities for dealing with images @@ -95,9 +95,9 @@ func (x *LazyImageLayers) extractLayers(ctx context.Context) (err error) { var extract func(context.Context, io.ReadCloser, string, []string) error switch x.Platform { - case constants.PlatformLinux: + case images.PlatformLinux: extract = linuxImage - case constants.PlatformWindows: + case images.PlatformWindows: if err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege}); err != nil { return err } diff --git a/test/internal/oci/oci.go b/test/internal/oci/oci.go index 25d1a74983..ed1068f8ed 100644 --- a/test/internal/oci/oci.go +++ b/test/internal/oci/oci.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/Microsoft/hcsshim/test/internal/constants" + "github.com/Microsoft/hcsshim/test/pkg/images" "github.com/containerd/containerd/containers" "github.com/containerd/containerd/namespaces" ctrdoci "github.com/containerd/containerd/oci" @@ -55,7 +55,7 @@ func DefaultLinuxSpec(ctx context.Context, tb testing.TB, nns string) *specs.Spe // See [CreateSpecWithPlatform] for more details. func CreateLinuxSpec(ctx context.Context, tb testing.TB, id string, opts ...ctrdoci.SpecOpts) *specs.Spec { tb.Helper() - return CreateSpecWithPlatform(ctx, tb, constants.PlatformLinux, id, opts...) + return CreateSpecWithPlatform(ctx, tb, images.PlatformLinux, id, opts...) } // CreateWindowsSpec returns the OCI spec for a Windows container. @@ -63,7 +63,7 @@ func CreateLinuxSpec(ctx context.Context, tb testing.TB, id string, opts ...ctrd // See [CreateSpecWithPlatform] for more details. func CreateWindowsSpec(ctx context.Context, tb testing.TB, id string, opts ...ctrdoci.SpecOpts) *specs.Spec { tb.Helper() - return CreateSpecWithPlatform(ctx, tb, constants.PlatformWindows, id, opts...) + return CreateSpecWithPlatform(ctx, tb, images.PlatformWindows, id, opts...) } // CreateSpecWithPlatform returns the OCI spec for the specified platform. diff --git a/test/internal/schemaversion_test.go b/test/internal/schemaversion_test.go index 33f9bfe00e..873a4148a3 100644 --- a/test/internal/schemaversion_test.go +++ b/test/internal/schemaversion_test.go @@ -11,7 +11,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" "github.com/sirupsen/logrus" - _ "github.com/Microsoft/hcsshim/test/internal/manifest" + _ "github.com/Microsoft/hcsshim/test/pkg/manifest" ) func init() { diff --git a/test/internal/scratch.go b/test/internal/scratch.go index cee87bec42..8afef0533d 100644 --- a/test/internal/scratch.go +++ b/test/internal/scratch.go @@ -12,7 +12,7 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" "github.com/Microsoft/hcsshim/internal/wclayer" - tuvm "github.com/Microsoft/hcsshim/test/internal/uvm" + tuvm "github.com/Microsoft/hcsshim/test/pkg/uvm" ) const lcowGlobalSVMID = "test.lcowglobalsvm" diff --git a/test/pkg/definitions/cmd/cmd.go b/test/pkg/definitions/cmd/cmd.go new file mode 100644 index 0000000000..9272d2d9ad --- /dev/null +++ b/test/pkg/definitions/cmd/cmd.go @@ -0,0 +1,9 @@ +//go:build windows + +package cmd + +import ( + internalcmd "github.com/Microsoft/hcsshim/internal/cmd" +) + +var CreatePipeAndListen = internalcmd.CreatePipeAndListen diff --git a/test/pkg/definitions/cpugroup/cpugroup.go b/test/pkg/definitions/cpugroup/cpugroup.go new file mode 100644 index 0000000000..5bbddb0f51 --- /dev/null +++ b/test/pkg/definitions/cpugroup/cpugroup.go @@ -0,0 +1,13 @@ +//go:build windows + +package cpugroup + +import ( + internalcpugroup "github.com/Microsoft/hcsshim/internal/cpugroup" +) + +var ( + ErrHVStatusInvalidCPUGroupState = internalcpugroup.ErrHVStatusInvalidCPUGroupState + Delete = internalcpugroup.Delete + Create = internalcpugroup.Create +) diff --git a/test/pkg/definitions/extendedtask/extendedtask.go b/test/pkg/definitions/extendedtask/extendedtask.go new file mode 100644 index 0000000000..632b2bdafb --- /dev/null +++ b/test/pkg/definitions/extendedtask/extendedtask.go @@ -0,0 +1,10 @@ +package extendedtask + +import ( + internalextended "github.com/Microsoft/hcsshim/internal/extendedtask" +) + +var NewExtendedTaskClient = internalextended.NewExtendedTaskClient + +type ComputeProcessorInfoRequest = internalextended.ComputeProcessorInfoRequest +type ComputeProcessorInfoResponse = internalextended.ComputeProcessorInfoResponse diff --git a/test/pkg/definitions/guestpath/guestpath.go b/test/pkg/definitions/guestpath/guestpath.go new file mode 100644 index 0000000000..9a24ea82c0 --- /dev/null +++ b/test/pkg/definitions/guestpath/guestpath.go @@ -0,0 +1,7 @@ +package guestpath + +import ( + internalguestpath "github.com/Microsoft/hcsshim/internal/guestpath" +) + +var HugePagesMountPrefix = internalguestpath.HugePagesMountPrefix diff --git a/test/pkg/definitions/hcs/hcs.go b/test/pkg/definitions/hcs/hcs.go new file mode 100644 index 0000000000..bb66064e51 --- /dev/null +++ b/test/pkg/definitions/hcs/hcs.go @@ -0,0 +1,12 @@ +//go:build windows + +package hcs + +import ( + internalhcs "github.com/Microsoft/hcsshim/internal/hcs" +) + +var ( + ErrOperationDenied = internalhcs.ErrOperationDenied + CreateNTFSVHD = internalhcs.CreateNTFSVHD +) diff --git a/test/pkg/definitions/lcow/lcow.go b/test/pkg/definitions/lcow/lcow.go new file mode 100644 index 0000000000..667050f82a --- /dev/null +++ b/test/pkg/definitions/lcow/lcow.go @@ -0,0 +1,9 @@ +//go:build windows + +package lcow + +import ( + internallcow "github.com/Microsoft/hcsshim/internal/lcow" +) + +var CreateScratch = internallcow.CreateScratch diff --git a/test/pkg/definitions/processorinfo/processorinfo.go b/test/pkg/definitions/processorinfo/processorinfo.go new file mode 100644 index 0000000000..ad3532d351 --- /dev/null +++ b/test/pkg/definitions/processorinfo/processorinfo.go @@ -0,0 +1,9 @@ +//go:build windows + +package processorinfo + +import ( + internalpinfo "github.com/Microsoft/hcsshim/internal/processorinfo" +) + +var HostProcessorInfo = internalpinfo.HostProcessorInfo diff --git a/test/pkg/definitions/shimdiag/shimdiag.go b/test/pkg/definitions/shimdiag/shimdiag.go new file mode 100644 index 0000000000..f26293254f --- /dev/null +++ b/test/pkg/definitions/shimdiag/shimdiag.go @@ -0,0 +1,16 @@ +//go:build windows + +package shimdiag + +import ( + internalshimdiag "github.com/Microsoft/hcsshim/internal/shimdiag" +) + +var ( + GetShim = internalshimdiag.GetShim + NewShimDiagClient = internalshimdiag.NewShimDiagClient +) + +type ExecProcessRequest = internalshimdiag.ExecProcessRequest +type ShareRequest = internalshimdiag.ShareRequest +type ShimDiagService = internalshimdiag.ShimDiagService diff --git a/test/pkg/definitions/tools/securitypolicy/helpers/securitypolicy.go b/test/pkg/definitions/tools/securitypolicy/helpers/securitypolicy.go new file mode 100644 index 0000000000..92d00aa1b9 --- /dev/null +++ b/test/pkg/definitions/tools/securitypolicy/helpers/securitypolicy.go @@ -0,0 +1,10 @@ +package helpers + +import ( + internalhelpers "github.com/Microsoft/hcsshim/internal/tools/securitypolicy/helpers" +) + +var ( + DefaultContainerConfigs = internalhelpers.DefaultContainerConfigs + PolicyContainersFromConfigs = internalhelpers.PolicyContainersFromConfigs +) diff --git a/test/pkg/definitions/winapi/winapi.go b/test/pkg/definitions/winapi/winapi.go new file mode 100644 index 0000000000..249373cad9 --- /dev/null +++ b/test/pkg/definitions/winapi/winapi.go @@ -0,0 +1,9 @@ +//go:build windows + +package winapi + +import ( + internalwinapi "github.com/Microsoft/hcsshim/internal/winapi" +) + +var UserNameCharLimit = internalwinapi.UserNameCharLimit diff --git a/test/pkg/doc.go b/test/pkg/doc.go new file mode 100644 index 0000000000..8c27230ec7 --- /dev/null +++ b/test/pkg/doc.go @@ -0,0 +1,6 @@ +package pkg + +// This package is to facilitate testing and has no guarantees about stability. +// Definitions may change without warning. +// +// DO NOT use in production code. diff --git a/test/internal/flag/flag.go b/test/pkg/flag/flag.go similarity index 100% rename from test/internal/flag/flag.go rename to test/pkg/flag/flag.go diff --git a/test/internal/constants/constants.go b/test/pkg/images/constants.go similarity index 97% rename from test/internal/constants/constants.go rename to test/pkg/images/constants.go index 0f668cd7fd..a6b50932cd 100644 --- a/test/internal/constants/constants.go +++ b/test/pkg/images/constants.go @@ -1,4 +1,4 @@ -package constants +package images import ( "fmt" diff --git a/test/internal/constants/images.go b/test/pkg/images/images.go similarity index 99% rename from test/internal/constants/images.go rename to test/pkg/images/images.go index 5703b51406..adcc905cf7 100644 --- a/test/internal/constants/images.go +++ b/test/pkg/images/images.go @@ -1,4 +1,4 @@ -package constants +package images // not technically constants, but close enough ... diff --git a/test/internal/manifest/manifest.go b/test/pkg/manifest/manifest.go similarity index 100% rename from test/internal/manifest/manifest.go rename to test/pkg/manifest/manifest.go diff --git a/test/internal/manifest/manifest.xml b/test/pkg/manifest/manifest.xml similarity index 100% rename from test/internal/manifest/manifest.xml rename to test/pkg/manifest/manifest.xml diff --git a/test/internal/manifest/resource_windows_386.syso b/test/pkg/manifest/resource_windows_386.syso similarity index 100% rename from test/internal/manifest/resource_windows_386.syso rename to test/pkg/manifest/resource_windows_386.syso diff --git a/test/internal/manifest/resource_windows_amd64.syso b/test/pkg/manifest/resource_windows_amd64.syso similarity index 100% rename from test/internal/manifest/resource_windows_amd64.syso rename to test/pkg/manifest/resource_windows_amd64.syso diff --git a/test/internal/manifest/resource_windows_arm.syso b/test/pkg/manifest/resource_windows_arm.syso similarity index 100% rename from test/internal/manifest/resource_windows_arm.syso rename to test/pkg/manifest/resource_windows_arm.syso diff --git a/test/internal/manifest/resource_windows_arm64.syso b/test/pkg/manifest/resource_windows_arm64.syso similarity index 100% rename from test/internal/manifest/resource_windows_arm64.syso rename to test/pkg/manifest/resource_windows_arm64.syso diff --git a/test/internal/manifest/versioninfo.json b/test/pkg/manifest/versioninfo.json similarity index 100% rename from test/internal/manifest/versioninfo.json rename to test/pkg/manifest/versioninfo.json diff --git a/test/internal/require/build.go b/test/pkg/require/build.go similarity index 78% rename from test/internal/require/build.go rename to test/pkg/require/build.go index 50473a973e..260fb6f535 100644 --- a/test/internal/require/build.go +++ b/test/pkg/require/build.go @@ -7,7 +7,7 @@ import ( "github.com/Microsoft/hcsshim/osversion" - _ "github.com/Microsoft/hcsshim/test/internal/manifest" // manifest test binary automatically + _ "github.com/Microsoft/hcsshim/test/pkg/manifest" // manifest test binary automatically ) func Build(tb testing.TB, b uint16) { diff --git a/test/internal/require/requires.go b/test/pkg/require/requires.go similarity index 96% rename from test/internal/require/requires.go rename to test/pkg/require/requires.go index 3bf77b54cf..b042d9f9ce 100644 --- a/test/internal/require/requires.go +++ b/test/pkg/require/requires.go @@ -5,7 +5,7 @@ import ( "path/filepath" "testing" - "github.com/Microsoft/hcsshim/test/internal/flag" + "github.com/Microsoft/hcsshim/test/pkg/flag" ) // Features checks the wanted features are present in given, diff --git a/test/internal/timeout/timeout.go b/test/pkg/timeout/timeout.go similarity index 100% rename from test/internal/timeout/timeout.go rename to test/pkg/timeout/timeout.go diff --git a/test/internal/uvm/lcow.go b/test/pkg/uvm/lcow.go similarity index 100% rename from test/internal/uvm/lcow.go rename to test/pkg/uvm/lcow.go diff --git a/test/internal/uvm/uvm.go b/test/pkg/uvm/uvm.go similarity index 95% rename from test/internal/uvm/uvm.go rename to test/pkg/uvm/uvm.go index 297580e55c..ca54bec865 100644 --- a/test/internal/uvm/uvm.go +++ b/test/pkg/uvm/uvm.go @@ -9,7 +9,7 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" - "github.com/Microsoft/hcsshim/test/internal/timeout" + "github.com/Microsoft/hcsshim/test/pkg/timeout" ) func Start(ctx context.Context, tb testing.TB, vm *uvm.UtilityVM) func() { diff --git a/test/internal/uvm/wcow.go b/test/pkg/uvm/wcow.go similarity index 93% rename from test/internal/uvm/wcow.go rename to test/pkg/uvm/wcow.go index f165e7a58d..dd327ddbc5 100644 --- a/test/internal/uvm/wcow.go +++ b/test/pkg/uvm/wcow.go @@ -8,8 +8,8 @@ import ( "github.com/Microsoft/hcsshim/internal/uvm" - "github.com/Microsoft/hcsshim/test/internal/constants" "github.com/Microsoft/hcsshim/test/internal/layers" + "github.com/Microsoft/hcsshim/test/pkg/images" ) // CreateWCOWUVM creates a WCOW utility VM with all default options. Returns the @@ -55,7 +55,7 @@ func CreateWCOWUVMFromOptsWithImage( tb.Fatal("opts must be set") } - img := layers.LazyImageLayers{Image: image, Platform: constants.PlatformWindows} + img := layers.LazyImageLayers{Image: image, Platform: images.PlatformWindows} tb.Cleanup(func() { if err := img.Close(ctx); err != nil { tb.Errorf("could not close image %s: %v", image, err) diff --git a/test/runhcs/e2e_matrix_test.go b/test/runhcs/e2e_matrix_test.go index d104c279a3..c39f4a1d3e 100644 --- a/test/runhcs/e2e_matrix_test.go +++ b/test/runhcs/e2e_matrix_test.go @@ -18,9 +18,9 @@ import ( "github.com/Microsoft/go-winio/vhd" "github.com/Microsoft/hcsshim/osversion" runhcs "github.com/Microsoft/hcsshim/pkg/go-runhcs" - "github.com/Microsoft/hcsshim/test/internal/constants" "github.com/Microsoft/hcsshim/test/internal/layers" - "github.com/Microsoft/hcsshim/test/internal/require" + "github.com/Microsoft/hcsshim/test/pkg/images" + "github.com/Microsoft/hcsshim/test/pkg/require" runc "github.com/containerd/go-runc" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" @@ -200,7 +200,7 @@ func testWindows(t *testing.T, version int, isolated bool) { // Get the LayerFolders imageName := getWindowsImageNameByVersion(t, version) - img := layers.LazyImageLayers{Image: imageName, Platform: constants.PlatformWindows} + img := layers.LazyImageLayers{Image: imageName, Platform: images.PlatformWindows} defer func() { if err := img.Close(ctx); err != nil { t.Errorf("could not close image %s: %v", imageName, err) diff --git a/test/runhcs/runhcs_test.go b/test/runhcs/runhcs_test.go index 24cf5ed1bd..5ee72f9500 100644 --- a/test/runhcs/runhcs_test.go +++ b/test/runhcs/runhcs_test.go @@ -4,5 +4,5 @@ package runhcs import ( - _ "github.com/Microsoft/hcsshim/test/internal/manifest" + _ "github.com/Microsoft/hcsshim/test/pkg/manifest" )