mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
Update migration test to use graphdriver env
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
2
.github/workflows/.test.yml
vendored
2
.github/workflows/.test.yml
vendored
@@ -27,7 +27,7 @@ env:
|
||||
ITG_CLI_MATRIX_SIZE: 6
|
||||
DOCKER_EXPERIMENTAL: 1
|
||||
DOCKER_GRAPHDRIVER: ${{ inputs.storage == 'snapshotter' && 'overlayfs' || 'overlay2' }}
|
||||
TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }}
|
||||
TEST_INTEGRATION_USE_GRAPHDRIVER: ${{ inputs.storage == 'graphdriver' && '1' || '' }}
|
||||
SETUP_BUILDX_VERSION: edge
|
||||
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
|
||||
|
||||
|
||||
6
.github/workflows/.windows.yml
vendored
6
.github/workflows/.windows.yml
vendored
@@ -364,10 +364,10 @@ jobs:
|
||||
"--exec-root=$env:TEMP\moby-exec", `
|
||||
"--pidfile=$env:TEMP\docker.pid", `
|
||||
"--register-service"
|
||||
If ("${{ inputs.storage }}" -eq "snapshotter") {
|
||||
If ("${{ inputs.storage }}" -eq "graphdriver") {
|
||||
# Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option.
|
||||
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_SNAPSHOTTER=1
|
||||
echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
||||
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_GRAPHDRIVER=1
|
||||
echo "TEST_INTEGRATION_USE_GRAPHDRIVER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
||||
}
|
||||
Write-Host "Starting service"
|
||||
Start-Service -Name docker
|
||||
|
||||
2
Makefile
2
Makefile
@@ -54,7 +54,7 @@ DOCKER_ENVS := \
|
||||
-e GITHUB_ACTIONS \
|
||||
-e TEST_FORCE_VALIDATE \
|
||||
-e TEST_INTEGRATION_DIR \
|
||||
-e TEST_INTEGRATION_USE_SNAPSHOTTER \
|
||||
-e TEST_INTEGRATION_USE_GRAPHDRIVER \
|
||||
-e TEST_INTEGRATION_FAIL_FAST \
|
||||
-e TEST_SKIP_INTEGRATION \
|
||||
-e TEST_SKIP_INTEGRATION_CLI \
|
||||
|
||||
@@ -210,7 +210,7 @@ test_env() {
|
||||
PATH="$PATH" \
|
||||
TEMP="$TEMP" \
|
||||
TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
|
||||
TEST_INTEGRATION_USE_SNAPSHOTTER="$TEST_INTEGRATION_USE_SNAPSHOTTER" \
|
||||
TEST_INTEGRATION_USE_GRAPHDRIVER="$TEST_INTEGRATION_USE_GRAPHDRIVER" \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="$OTEL_EXPORTER_OTLP_ENDPOINT" \
|
||||
OTEL_SERVICE_NAME="$OTEL_SERVICE_NAME" \
|
||||
"$@"
|
||||
|
||||
@@ -15,7 +15,7 @@ source hack/make/.integration-test-helpers
|
||||
: "${PY_TEST_OPTIONS:=--junitxml=${DEST}/junit-report.xml}"
|
||||
|
||||
# build --squash is not supported with containerd integration.
|
||||
if [ -n "$TEST_INTEGRATION_USE_SNAPSHOTTER" ]; then
|
||||
if [ -z "$TEST_INTEGRATION_USE_GRAPHDRIVER" ]; then
|
||||
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_build_test.py::BuildTest::test_build_squash"
|
||||
fi
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/v2/integration/internal/container"
|
||||
"github.com/moby/moby/v2/testutil"
|
||||
"github.com/moby/moby/v2/testutil/daemon"
|
||||
@@ -27,7 +28,7 @@ func TestMigrateNativeSnapshotter(t *testing.T) {
|
||||
|
||||
func testMigrateSnapshotter(t *testing.T, graphdriver, snapshotter string) {
|
||||
skip.If(t, runtime.GOOS != "linux")
|
||||
skip.If(t, os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != "")
|
||||
skip.If(t, os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "")
|
||||
|
||||
ctx := testutil.StartSpan(baseContext, t)
|
||||
|
||||
@@ -89,7 +90,7 @@ func testMigrateSnapshotter(t *testing.T, graphdriver, snapshotter string) {
|
||||
|
||||
func TestMigrateSaveLoad(t *testing.T) {
|
||||
skip.If(t, runtime.GOOS != "linux")
|
||||
skip.If(t, os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != "")
|
||||
skip.If(t, os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == "")
|
||||
|
||||
var (
|
||||
ctx = testutil.StartSpan(baseContext, t)
|
||||
@@ -125,7 +126,7 @@ func TestMigrateSaveLoad(t *testing.T) {
|
||||
apiClient := d.NewClientT(t)
|
||||
|
||||
// Save image to buffer
|
||||
rdr, err := apiClient.ImageSave(ctx, []string{"busybox:latest"}, image.SaveOptions{})
|
||||
rdr, err := apiClient.ImageSave(ctx, []string{"busybox:latest"})
|
||||
assert.NilError(t, err)
|
||||
buf := bytes.NewBuffer(nil)
|
||||
io.Copy(buf, rdr)
|
||||
@@ -135,7 +136,7 @@ func TestMigrateSaveLoad(t *testing.T) {
|
||||
list, err := apiClient.ImageList(ctx, image.ListOptions{})
|
||||
assert.NilError(t, err)
|
||||
for _, i := range list {
|
||||
_, err = apiClient.ImageRemove(ctx, i.ID, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, i.ID, image.RemoveOptions{Force: true})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ func TestMigrateSaveLoad(t *testing.T) {
|
||||
assert.Equal(t, info.Images, 0)
|
||||
|
||||
// Import
|
||||
lr, err := apiClient.ImageLoad(ctx, bytes.NewReader(buf.Bytes()), image.LoadOptions{Quiet: true})
|
||||
lr, err := apiClient.ImageLoad(ctx, bytes.NewReader(buf.Bytes()), client.ImageLoadWithQuiet(true))
|
||||
assert.NilError(t, err)
|
||||
io.Copy(io.Discard, lr.Body)
|
||||
lr.Body.Close()
|
||||
|
||||
@@ -189,10 +189,9 @@ func (e *Execution) IsUserNamespaceInKernel() bool {
|
||||
}
|
||||
|
||||
// UsingSnapshotter returns whether containerd snapshotters are used for the
|
||||
// tests by checking if the "TEST_INTEGRATION_USE_SNAPSHOTTER" is set to a
|
||||
// non-empty value.
|
||||
// tests by checking if the "TEST_INTEGRATION_USE_GRAPHDRIVER" is empty
|
||||
func (e *Execution) UsingSnapshotter() bool {
|
||||
return os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != ""
|
||||
return os.Getenv("TEST_INTEGRATION_USE_GRAPHDRIVER") == ""
|
||||
}
|
||||
|
||||
// HasExistingImage checks whether there is an image with the given reference.
|
||||
|
||||
Reference in New Issue
Block a user