forked from microsoft/hcsshim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused/legacy functional test flags/environment variables. Unify [TestMain] control flow, so there is only one exit call, and `defer` is used to run cleanup after the tests are run. Standardize UVM `default[L|W]COWOptions` to accept a context, and add context parameter to `namespacedContext` Remove all build tags aside from `functional`, since features are used to select the tests to run. This standardizes the functional tests with the cri-containerd tests, even though the feature names themselves are different. Add `test/pkg/uvm.CreateWCOW` function to mirror `CreateLCOW`, and add `Create` and `CreateAndStart` functions that pick LCOW or WCOW based on the options provided. Have uVM scratch and image layers be created under a dedicated and persisted folder within `%TEMP%` that is excluded from Windows defender. (The folder will be removed during OS restart, regardless of contents.) Remove copied OCI spec options from `test/internal/oci`, add new options for creating HostProcess containers. Add a `internal\sync.OnceValue`(`Ctx`) function that mirrors `sync.OnceValues` (introduced in go1.21) to have a type-safe `Once` function. Check that required privileges are held (only once) when unpacking Windows layers. Fix LCOW tests in `lcow_test.go` that were setting `KernelDirect` without also updating `KernelFile`. Add `util.Context` function to create context that times out before test timeout, to help with timing issues and allow time for cleanup and logging. Rename `cri_util` to `criutil`, since underscores are frowned upon in package names. Add a `test` prefix to `github.com/Microsoft/hcsshim/test/pkg/*` and `github.com/Microsoft/hcsshim/test/internal/*` imports to be consistent across all `test/functional/*` files. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
- Loading branch information
Showing
34 changed files
with
995 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package sync | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
) | ||
|
||
// TODO (go1.21): use pkg.go.dev/sync#OnceValues | ||
|
||
// OnceValue is a wrapper around [sync.Once] that runs f only once and | ||
// returns both a value (of type T) and an error. | ||
func OnceValue[T any](f func() (T, error)) func() (T, error) { | ||
var ( | ||
once sync.Once | ||
v T | ||
err error | ||
) | ||
|
||
return func() (T, error) { | ||
once.Do(func() { | ||
v, err = f() | ||
}) | ||
return v, err | ||
} | ||
} | ||
|
||
// NewOnce is similar to [OnceValue], but allows passing a context to f. | ||
func OnceValueCtx[T any](f func(ctx context.Context) (T, error)) func(context.Context) (T, error) { | ||
var ( | ||
once sync.Once | ||
v T | ||
err error | ||
) | ||
|
||
return func(ctx context.Context) (T, error) { | ||
once.Do(func() { | ||
v, err = f(ctx) | ||
}) | ||
return v, err | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,5 +146,4 @@ func TestCimReadWrite(t *testing.T) { | |
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.