From 5507998651c870ec00fa1207c3a997c563a316e8 Mon Sep 17 00:00:00 2001 From: Yadong Ding Date: Thu, 14 Dec 2023 15:50:12 +0800 Subject: [PATCH] tests: remove useless test files Since https://github.com/dragonflyoss/nydus/pull/983, we have the new smoke test, we can remove the old smoke test files including nydusify and nydus. Signed-off-by: Yadong Ding --- Makefile | 39 +-- contrib/nydusify/Makefile | 5 +- contrib/nydusify/tests/e2e_test.go | 233 ------------------ contrib/nydusify/tests/image_test.go | 54 ---- contrib/nydusify/tests/nydusify.go | 141 ----------- contrib/nydusify/tests/registry.go | 119 --------- .../tests/texture/chunk-dict-1/Dockerfile | 5 - .../tests/texture/chunk-dict-2/Dockerfile | 5 - .../tests/texture/image-basic/Dockerfile | 7 - .../tests/texture/image-from-1/Dockerfile | 4 - .../tests/texture/image-from-2/Dockerfile | 12 - misc/nydus-smoke/Dockerfile | 14 -- misc/nydusify-smoke/Dockerfile | 10 - misc/nydusify-smoke/entrypoint.sh | 9 - 14 files changed, 2 insertions(+), 655 deletions(-) delete mode 100644 contrib/nydusify/tests/e2e_test.go delete mode 100644 contrib/nydusify/tests/image_test.go delete mode 100644 contrib/nydusify/tests/nydusify.go delete mode 100644 contrib/nydusify/tests/registry.go delete mode 100644 contrib/nydusify/tests/texture/chunk-dict-1/Dockerfile delete mode 100644 contrib/nydusify/tests/texture/chunk-dict-2/Dockerfile delete mode 100644 contrib/nydusify/tests/texture/image-basic/Dockerfile delete mode 100644 contrib/nydusify/tests/texture/image-from-1/Dockerfile delete mode 100644 contrib/nydusify/tests/texture/image-from-2/Dockerfile delete mode 100644 misc/nydus-smoke/Dockerfile delete mode 100644 misc/nydusify-smoke/Dockerfile delete mode 100644 misc/nydusify-smoke/entrypoint.sh diff --git a/Makefile b/Makefile index 89e4d33f367..77e2952ce99 100644 --- a/Makefile +++ b/Makefile @@ -52,12 +52,6 @@ current_dir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) env_go_path := $(shell go env GOPATH 2> /dev/null) go_path := $(if $(env_go_path),$(env_go_path),"$(HOME)/go") -# Set the env DIND_CACHE_DIR to specify a cache directory for -# docker-in-docker container, used to cache data for docker pull, -# then mitigate the impact of docker hub rate limit, for example: -# env DIND_CACHE_DIR=/path/to/host/var-lib-docker make docker-nydusify-smoke -dind_cache_mount := $(if $(DIND_CACHE_DIR),-v $(DIND_CACHE_DIR):/var/lib/docker,) - # Functions # Func: build golang target in docker @@ -129,7 +123,7 @@ coverage: pre-coverage # write unit teset coverage to codecov.json, used for Github CI coverage-codecov: TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) ${CARGO} llvm-cov --codecov --output-path codecov.json --workspace $(EXCLUDE_PACKAGES) $(CARGO_COMMON) $(CARGO_BUILD_FLAGS) -- --skip integration --nocapture --test-threads=8 - + smoke-only: make -C smoke test @@ -141,37 +135,6 @@ smoke-benchmark: smoke: release smoke-only -docker-nydus-smoke: - docker build -t nydus-smoke --build-arg RUST_TARGET=${RUST_TARGET_STATIC} misc/nydus-smoke - docker run --rm --privileged ${CARGO_BUILD_GEARS} \ - -e TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) \ - -v ~/.cargo:/root/.cargo \ - -v $(TEST_WORKDIR_PREFIX) \ - -v ${current_dir}:/nydus-rs \ - nydus-smoke - -# TODO: Nydusify smoke has to be time consuming for a while since it relies on musl nydusd and nydus-image. -# So musl compilation must be involved. -# And docker-in-docker deployment involves image building? -docker-nydusify-smoke: docker-static - $(call build_golang,$(NYDUSIFY_PATH),make build-smoke) - docker build -t nydusify-smoke misc/nydusify-smoke - docker run --rm --privileged \ - -e BACKEND_TYPE=$(BACKEND_TYPE) \ - -e BACKEND_CONFIG=$(BACKEND_CONFIG) \ - -v $(current_dir):/nydus-rs $(dind_cache_mount) nydusify-smoke TestSmoke - -docker-nydusify-image-test: docker-static - $(call build_golang,$(NYDUSIFY_PATH),make build-smoke) - docker build -t nydusify-smoke misc/nydusify-smoke - docker run --rm --privileged \ - -e BACKEND_TYPE=$(BACKEND_TYPE) \ - -e BACKEND_CONFIG=$(BACKEND_CONFIG) \ - -v $(current_dir):/nydus-rs $(dind_cache_mount) nydusify-smoke TestDockerHubImage - -# Run integration smoke test in docker-in-docker container. It requires some special settings, -docker-smoke: docker-nydus-smoke docker-nydusify-smoke - contrib-build: nydusify ctr-remote nydus-overlayfs contrib-release: nydusify-release ctr-remote-release \ diff --git a/contrib/nydusify/Makefile b/contrib/nydusify/Makefile index 7d03a851221..c4dcddd07db 100644 --- a/contrib/nydusify/Makefile +++ b/contrib/nydusify/Makefile @@ -26,7 +26,7 @@ release: plugin: @CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -o nydus-hook-plugin ./plugin -test: build build-smoke +test: build @go vet $(PACKAGES) golangci-lint run @go test -covermode=atomic -coverprofile=coverage.out -count=1 -v -timeout 20m -race ./pkg/... ./cmd/... @@ -37,6 +37,3 @@ coverage: test clean: rm -f cmd/nydusify rm -f coverage.out - -build-smoke: - ${PROXY} go test -race -v -c -o ./nydusify-smoke ./tests diff --git a/contrib/nydusify/tests/e2e_test.go b/contrib/nydusify/tests/e2e_test.go deleted file mode 100644 index 336f6f17ffd..00000000000 --- a/contrib/nydusify/tests/e2e_test.go +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2020 Ant Group. All rights reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -package tests - -import ( - "context" - "encoding/json" - "fmt" - "os" - "testing" - "time" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/credentials" - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/dragonflyoss/image-service/contrib/nydusify/pkg/backend" - "github.com/dragonflyoss/image-service/contrib/nydusify/pkg/utils" - "github.com/sirupsen/logrus" - "github.com/stretchr/testify/assert" -) - -func testBasicConvert(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - registry.Build(t, "image-basic") - nydusify := NewNydusify(registry, "image-basic", "image-basic-nydus", "", "", fsVersion, "") - nydusify.Convert(t) - nydusify.Check(t) -} - -func testBasicAuth(t *testing.T, fsVersion string) { - registry := NewAuthRegistry(t) - defer registry.Destroy(t) - registry.AuthBuild(t, "image-basic") - nydusify := NewNydusify(registry, "image-basic", "image-basic-nydus", "", "", fsVersion, "") - nydusify.Convert(t) - nydusify.Check(t) -} - -func testReproducibleBuild(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - registry.Build(t, "image-basic") - defer registry.Destroy(t) - var initBootstraHash []byte - // Build the same image repeatedly to verify that the bootstarp files are the same - for i := 0; i < 5; i++ { - workDir := fmt.Sprintf("./tmp-%d", i) - os.Setenv("WORKDIR", workDir) - nydusify := NewNydusify(registry, "image-basic", "image-basic-nydus", "", "", fsVersion, "") - nydusify.Convert(t) - nydusify.Check(t) - hash, err := utils.HashFile(nydusify.GetBootstarpFilePath()) - if err != nil { - t.Fatalf("expect bootstrap file must exist, but actual is not, error: %s", err) - } - if len(initBootstraHash) == 0 { - initBootstraHash = hash - } else { - assert.Equal(t, initBootstraHash, hash) - } - } -} - -func testConvertWithCache(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - - registry.Build(t, "image-basic") - nydusify1 := NewNydusify(registry, "image-basic", "image-basic-nydus-1", "cache:v1", "", fsVersion, "") - nydusify1.Convert(t) - nydusify1.Check(t) - nydusify2 := NewNydusify(registry, "image-basic", "image-basic-nydus-2", "cache:v1", "", fsVersion, "") - nydusify2.Convert(t) - nydusify2.Check(t) - - registry.Build(t, "image-from-1") - nydusify3 := NewNydusify(registry, "image-from-1", "image-from-nydus-1", "cache:v1", "", fsVersion, "") - nydusify3.Convert(t) - nydusify3.Check(t) - - registry.Build(t, "image-from-2") - nydusify4 := NewNydusify(registry, "image-from-2", "image-from-nydus-2", "cache:v1", "", fsVersion, "") - nydusify4.Convert(t) - nydusify4.Check(t) -} - -func testConvertWithChunkDict(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - - registry.Build(t, "chunk-dict-1") - // build chunk-dict-1 bootstrap - nydusify1 := NewNydusify(registry, "chunk-dict-1", "nydus:chunk-dict-1", "", "", fsVersion, "") - nydusify1.Convert(t) - nydusify1.Check(t) - chunkDictOpt := fmt.Sprintf("bootstrap:registry:%s/%s", registry.Host(), "nydus:chunk-dict-1") - // build without build-cache - registry.Build(t, "image-basic") - nydusify2 := NewNydusify(registry, "image-basic", "nydus:image-basic", "", chunkDictOpt, fsVersion, "") - nydusify2.Convert(t) - nydusify2.Check(t) - // build with build-cache - registry.Build(t, "image-from-1") - nydusify3 := NewNydusify(registry, "image-from-1", "nydus:image-from-1", "nydus:cache_v1", chunkDictOpt, fsVersion, "") - nydusify3.Convert(t) - nydusify3.Check(t) - // change chunk dict - registry.Build(t, "chunk-dict-2") - nydusify4 := NewNydusify(registry, "chunk-dict-2", "nydus:chunk-dict-2", "", "", fsVersion, "") - nydusify4.Convert(t) - nydusify4.Check(t) - chunkDictOpt = fmt.Sprintf("bootstrap:registry:%s/%s", registry.Host(), "nydus:chunk-dict-2") - registry.Build(t, "image-from-2") - nydusify5 := NewNydusify(registry, "image-from-2", "nydus:image-from-2", "nydus:cache_v1", chunkDictOpt, fsVersion, "") - nydusify5.Convert(t) - nydusify5.Check(t) -} - -func testConvertWithS3Backend(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - registry.Build(t, "image-basic") - - // set up a minio server to mock s3 service - accessKey := "minio" - accessSecret := "minio123" - region := "us-east-1" - bucketName := "nydus" - minioPort := 9000 - minioContainerName := "minio" - minioDataDir := "/tmp/minio-data" - endpoint := fmt.Sprintf("localhost:%d", minioPort) - createMinioContainerCmd := fmt.Sprintf(` - docker run -p %d:9000 -d -v %s:/data \ - -e "MINIO_ACCESS_KEY=%s" \ - -e "MINIO_SECRET_KEY=%s" \ - -e "MINIO_REGION=%s" \ - --name %s minio/minio server /data`, - minioPort, minioDataDir, accessKey, accessSecret, region, minioContainerName) - if err := os.MkdirAll(minioDataDir, 0755); err != nil { - t.Fatalf("failed to create minio data dir: %s", err) - } - defer os.RemoveAll(minioDataDir) - run(t, createMinioContainerCmd, false) - defer run(t, fmt.Sprintf("docker rm -f %s", minioContainerName), false) - - // wait for the minio container to be up - time.Sleep(5 * time.Second) - - // create bucket - s3Client := s3.NewFromConfig(aws.Config{}, func(o *s3.Options) { - o.BaseEndpoint = aws.String("http://" + endpoint) - o.Region = region - o.UsePathStyle = true - o.Credentials = credentials.NewStaticCredentialsProvider(accessKey, accessSecret, "") - o.UsePathStyle = true - }) - createBucketInput := s3.CreateBucketInput{Bucket: &bucketName} - _, err := s3Client.CreateBucket(context.TODO(), &createBucketInput) - if err != nil { - t.Fatalf(err.Error()) - - } - logrus.Infof("create s3 backend bucket %s", bucketName) - - s3Config := &backend.S3Config{ - AccessKeyID: accessKey, - AccessKeySecret: accessSecret, - Endpoint: endpoint, - Scheme: "http", - BucketName: bucketName, - Region: region, - ObjectPrefix: "path/to/registry", - } - s3ConfigBytes, err := json.Marshal(s3Config) - if err != nil { - t.Fatalf("marshal s3 config failed: %v", err) - } - - originalBackendConfig := os.Getenv("BACKEND_CONFIG") - backendConfig := string(s3ConfigBytes) - if err := os.Setenv("BACKEND_CONFIG", backendConfig); err != nil { - t.Fatalf("set env BACKEND_CONFIG failed: %v", err) - } - defer os.Setenv("BACKEND_CONFIG", originalBackendConfig) - - originalBackendType := os.Getenv("BACKEND_TYPE") - if err := os.Setenv("BACKEND_TYPE", "s3"); err != nil { - t.Fatalf("set env BACKEND_TYPE failed: %v", err) - } - defer os.Setenv("BACKEND_TYPE", originalBackendType) - - logrus.Infof("use s3 backend config: %s", backendConfig) - - nydusify := NewNydusify(registry, "image-basic", "image-basic-nydus", "", "", fsVersion, "") - nydusify.Convert(t) - nydusify.Check(t) -} - -func testConvertWithBatchSize(t *testing.T, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - - registry.Build(t, "image-basic") - nydusify1 := NewNydusify(registry, "image-basic", "image-basic-nydus-1", "", "", fsVersion, "0x1000") - nydusify1.Convert(t) - nydusify1.Check(t) - nydusify2 := NewNydusify(registry, "image-basic", "image-basic-nydus-2", "", "", fsVersion, "0x10000") - nydusify2.Convert(t) - nydusify2.Check(t) - nydusify3 := NewNydusify(registry, "image-basic", "image-basic-nydus-3", "", "", fsVersion, "0x100000") - nydusify3.Convert(t) - nydusify3.Check(t) - nydusify4 := NewNydusify(registry, "image-basic", "image-basic-nydus-4", "", "", fsVersion, "0x1000000") - nydusify4.Convert(t) - nydusify4.Check(t) -} - -func TestSmoke(t *testing.T) { - fsVersions := [2]string{"5", "6"} - for _, v := range fsVersions { - testBasicConvert(t, v) - testBasicAuth(t, v) - testReproducibleBuild(t, v) - testConvertWithCache(t, v) - testConvertWithChunkDict(t, v) - testConvertWithS3Backend(t, v) - } - // batch-size only support v6 - testConvertWithBatchSize(t, fsVersions[1]) -} diff --git a/contrib/nydusify/tests/image_test.go b/contrib/nydusify/tests/image_test.go deleted file mode 100644 index 2228279fcf3..00000000000 --- a/contrib/nydusify/tests/image_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2020 Ant Group. All rights reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -package tests - -import ( - "fmt" - "testing" -) - -var list = []string{ - "alpine", - "busybox", - "ubuntu", - "redis", - "node", - "python", - "nginx", - "golang", - "wordpress", - "mongo", - "debian", - // An alternative for open jdk image, see: - // https://hub.docker.com/_/openjdk - // https://github.com/docker-library/openjdk/issues/505 - "amazoncorretto", - "ruby", - "php", - "tomcat", -} - -func transfer(t *testing.T, ref string) { - run(t, fmt.Sprintf("docker pull %s", ref), true) - host := fmt.Sprintf("localhost:%d", registryPort) - run(t, fmt.Sprintf("docker tag %s %s/%s", ref, host, ref), true) - run(t, fmt.Sprintf("docker push %s/%s", host, ref), true) -} - -func convert(t *testing.T, ref string, fsVersion string) { - registry := NewRegistry(t) - defer registry.Destroy(t) - transfer(t, ref) - nydusify := NewNydusify(registry, ref, fmt.Sprintf("%s-nydus", ref), "", "", fsVersion, "") - nydusify.Convert(t) - nydusify.Check(t) -} - -func TestDockerHubImage(t *testing.T) { - for _, ref := range list { - convert(t, ref, "5") - convert(t, ref, "6") - } -} diff --git a/contrib/nydusify/tests/nydusify.go b/contrib/nydusify/tests/nydusify.go deleted file mode 100644 index 4467d35e64d..00000000000 --- a/contrib/nydusify/tests/nydusify.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2020 Ant Group. All rights reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -package tests - -import ( - "context" - "os" - "path/filepath" - "testing" - - "github.com/sirupsen/logrus" - "github.com/stretchr/testify/assert" - - "github.com/dragonflyoss/image-service/contrib/nydusify/pkg/checker" - "github.com/dragonflyoss/image-service/contrib/nydusify/pkg/converter" -) - -var nydusImagePath string -var nydusdPath string - -func init() { - nydusImagePath = os.Getenv("NYDUS_IMAGE") - if nydusImagePath == "" { - panic("Please specify nydus-image path by env NYDUS_IMAGE") - } - nydusdPath = os.Getenv("NYDUSD") - if nydusdPath == "" { - panic("Please specify nydusd path by env NYDUSD") - } -} - -type Nydusify struct { - Registry *Registry - Source string - Target string - Cache string - backendType string - backendConfig string - chunkDictArgs string - fsVersion string - workDir string - batchSize string -} - -func NewNydusify(registry *Registry, source, target, cache string, chunkDictArgs string, fsVersion string, batchSize string) *Nydusify { - backendType := "" - if os.Getenv("BACKEND_TYPE") != "" { - backendType = os.Getenv("BACKEND_TYPE") - } - backendConfig := "" - if os.Getenv("BACKEND_CONFIG") != "" { - backendConfig = os.Getenv("BACKEND_CONFIG") - } - if len(fsVersion) == 0 { - fsVersion = "5" - } - - workDir := "./tmp" - if os.Getenv("WORKDIR") != "" { - workDir = os.Getenv("WORKDIR") - } - - if len(batchSize) == 0 { - batchSize = "0" - } - - return &Nydusify{ - Registry: registry, - Source: source, - Target: target, - Cache: cache, - backendType: backendType, - backendConfig: backendConfig, - chunkDictArgs: chunkDictArgs, - fsVersion: fsVersion, - workDir: workDir, - batchSize: batchSize, - } -} - -func (nydusify *Nydusify) GetBootstarpFilePath() string { - return filepath.Join(filepath.Join(nydusify.workDir, nydusify.Target), "nydus_bootstrap") -} - -func (nydusify *Nydusify) Convert(t *testing.T) { - host := nydusify.Registry.Host() - buildCache := "" - if nydusify.Cache != "" { - buildCache = host + "/" + nydusify.Cache - } - - opt := converter.Opt{ - Platforms: "linux/amd64", - Source: host + "/" + nydusify.Source, - Target: host + "/" + nydusify.Target, - - CacheRef: buildCache, - CacheMaxRecords: 10, - CacheVersion: "v1", - - WorkDir: nydusify.workDir, - PrefetchPatterns: "/", - NydusImagePath: nydusImagePath, - MergePlatform: false, - Docker2OCI: true, - - BackendType: nydusify.backendType, - BackendConfig: nydusify.backendConfig, - - FsVersion: nydusify.fsVersion, - - BatchSize: nydusify.batchSize, - } - - err := converter.Convert(context.Background(), opt) - assert.Nil(t, err) -} - -func (nydusify *Nydusify) Check(t *testing.T) { - host := nydusify.Registry.Host() - logrus.Infof("the backend type used by 'nydusify check': %s", nydusify.backendType) - logrus.Infof("the backend config used by 'nydusify check': %s", nydusify.backendConfig) - checker, err := checker.New(checker.Opt{ - WorkDir: filepath.Join(nydusify.workDir, nydusify.Target), - Source: host + "/" + nydusify.Source, - Target: host + "/" + nydusify.Target, - SourceInsecure: true, - TargetInsecure: true, - NydusImagePath: nydusImagePath, - NydusdPath: nydusdPath, - ExpectedArch: "amd64", - BackendType: nydusify.backendType, - BackendConfig: nydusify.backendConfig, - }) - assert.Nil(t, err) - - err = checker.Check(context.Background()) - assert.Nil(t, err) -} diff --git a/contrib/nydusify/tests/registry.go b/contrib/nydusify/tests/registry.go deleted file mode 100644 index 7612a5332b3..00000000000 --- a/contrib/nydusify/tests/registry.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2020 Ant Group. All rights reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -package tests - -import ( - "encoding/base64" - "fmt" - "os" - "os/exec" - "path" - "path/filepath" - "testing" - "time" - - "github.com/docker/cli/cli/config" - "github.com/stretchr/testify/assert" -) - -var registryPort = 5051 - -func run(t *testing.T, cmd string, ignoreStatus bool) { - _cmd := exec.Command("sh", "-c", cmd) - _cmd.Stdout = os.Stdout - _cmd.Stderr = os.Stderr - err := _cmd.Run() - if !ignoreStatus { - assert.Nil(t, err) - } -} - -func runWithOutput(t *testing.T, cmd string) string { - _cmd := exec.Command("sh", "-c", cmd) - _cmd.Stderr = os.Stderr - output, err := _cmd.Output() - assert.Nil(t, err) - return string(output) -} - -type Registry struct { - id string - host string - authFile string - authString string // base64(username:password) - configFile string -} - -func NewAuthRegistry(t *testing.T) *Registry { - err := os.Mkdir("auth", 0755) - assert.Nil(t, err) - authString := runWithOutput(t, "docker run --rm --entrypoint htpasswd httpd:2 -Bbn testuser testpassword") - authFile, _ := filepath.Abs(filepath.Join("auth", "htpasswd")) - err = os.WriteFile(authFile, []byte(authString), 0644) - assert.Nil(t, err) - - err = os.Mkdir(".docker", 0755) - assert.Nil(t, err) - base64AuthString := base64.StdEncoding.EncodeToString([]byte("testuser:testpassword")) - configString := fmt.Sprintf(`{"auths": { "localhost:%d": { "auth": "%s" }}}`, - registryPort, base64AuthString) - configFile, _ := filepath.Abs(filepath.Join(".docker", "config.json")) - // Since docker config is only loaded once (sync.Once is used), - // it is better to use config.SetDir here. - // See: https://github.com/docker/cli/blob/139e924690b9b3f5e49c86d93a4025da9d47c6a9/cli/config/config.go#L49 - config.SetDir(path.Dir(configFile)) - err = os.WriteFile(configFile, []byte(configString), 0644) - assert.Nil(t, err) - - containerID := runWithOutput(t, fmt.Sprintf("docker run -p %d:5000 --rm -d -v %s:/auth "+ - `-e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" `+ - "-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2", registryPort, path.Dir(authFile))) - time.Sleep(time.Second * 2) - - return &Registry{ - id: containerID, - host: fmt.Sprintf("localhost:%d", registryPort), - authFile: authFile, - authString: base64AuthString, - configFile: configFile, - } -} - -func NewRegistry(t *testing.T) *Registry { - containerID := runWithOutput(t, fmt.Sprintf("docker run -p %d:5000 -d registry:2", registryPort)) - time.Sleep(time.Second * 2) - return &Registry{ - id: containerID, - host: fmt.Sprintf("localhost:%d", registryPort), - } -} - -func (registry *Registry) Destroy(t *testing.T) { - run(t, fmt.Sprintf("docker stop %s", registry.id), true) - run(t, fmt.Sprintf("docker rm -f %s", registry.id), true) - if registry.authFile != "" { - os.RemoveAll(path.Dir(registry.authFile)) - } - if registry.configFile != "" { - os.RemoveAll(path.Dir(registry.configFile)) - } -} - -func (registry *Registry) Build(t *testing.T, source string) { - run(t, fmt.Sprintf("docker rmi -f %s/%s", registry.Host(), source), true) - run(t, fmt.Sprintf("docker build -t %s/%s ./texture/%s", registry.Host(), source, source), false) - run(t, fmt.Sprintf("docker push %s/%s", registry.Host(), source), false) -} - -func (registry *Registry) AuthBuild(t *testing.T, source string) { - run(t, fmt.Sprintf("docker rmi -f %s/%s", registry.Host(), source), true) - run(t, fmt.Sprintf("docker build -t %s/%s ./texture/%s", registry.Host(), source, source), false) - run(t, fmt.Sprintf("docker login -u testuser -p testpassword %s", registry.Host()), false) - run(t, fmt.Sprintf("docker push %s/%s", registry.Host(), source), false) -} - -func (registry *Registry) Host() string { - return registry.host -} diff --git a/contrib/nydusify/tests/texture/chunk-dict-1/Dockerfile b/contrib/nydusify/tests/texture/chunk-dict-1/Dockerfile deleted file mode 100644 index c2fa157ce40..00000000000 --- a/contrib/nydusify/tests/texture/chunk-dict-1/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu - -RUN echo test3 > /test3 -RUN echo test5 > /test5 -RUN echo test7 > /test7 \ No newline at end of file diff --git a/contrib/nydusify/tests/texture/chunk-dict-2/Dockerfile b/contrib/nydusify/tests/texture/chunk-dict-2/Dockerfile deleted file mode 100644 index 8a20bddc98a..00000000000 --- a/contrib/nydusify/tests/texture/chunk-dict-2/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu - -RUN echo test5 > /test5 -RUN echo test7 > /test7 -RUN echo test9 > /test9 \ No newline at end of file diff --git a/contrib/nydusify/tests/texture/image-basic/Dockerfile b/contrib/nydusify/tests/texture/image-basic/Dockerfile deleted file mode 100644 index 246d17f24df..00000000000 --- a/contrib/nydusify/tests/texture/image-basic/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu - -RUN touch /test1 -RUN touch /test2 -RUN touch /test3 -RUN echo test3 > /test3 -RUN rm /test1 diff --git a/contrib/nydusify/tests/texture/image-from-1/Dockerfile b/contrib/nydusify/tests/texture/image-from-1/Dockerfile deleted file mode 100644 index 1da2219c3c3..00000000000 --- a/contrib/nydusify/tests/texture/image-from-1/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM localhost:5051/image-basic - -RUN touch /test4 -RUN echo test5 > /test5 diff --git a/contrib/nydusify/tests/texture/image-from-2/Dockerfile b/contrib/nydusify/tests/texture/image-from-2/Dockerfile deleted file mode 100644 index abed94cd510..00000000000 --- a/contrib/nydusify/tests/texture/image-from-2/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM localhost:5051/image-from-1 - -RUN touch /test6 -RUN echo test7 > /test7 - -RUN touch /test6 -RUN echo test7 > /test7 - -RUN echo test8 > /test8 -RUN chmod +x /test8 -RUN echo test9 > /test9 -RUN rm /test9 diff --git a/misc/nydus-smoke/Dockerfile b/misc/nydus-smoke/Dockerfile deleted file mode 100644 index cfdf6ea0285..00000000000 --- a/misc/nydus-smoke/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM rust:1.68.2 -ARG RUST_TARGET=x86_64-unknown-linux-musl - -RUN mkdir /root/.cargo/ -RUN rustup component add rustfmt && rustup component add clippy - -ENV CARGO_HOME=/root/.cargo -RUN apt update && apt install -y cmake tree - -WORKDIR /nydus-rs - -VOLUME /tmp - -CMD make release smoke diff --git a/misc/nydusify-smoke/Dockerfile b/misc/nydusify-smoke/Dockerfile deleted file mode 100644 index 59c5b5d8134..00000000000 --- a/misc/nydusify-smoke/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM docker:dind - -ENV NYDUS_IMAGE=/nydus-rs/target/x86_64-unknown-linux-musl/release/nydus-image -ENV NYDUSD=/nydus-rs/target/x86_64-unknown-linux-musl/release/nydusd -WORKDIR /nydus-rs/contrib/nydusify/tests - -ADD ./entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/misc/nydusify-smoke/entrypoint.sh b/misc/nydusify-smoke/entrypoint.sh deleted file mode 100644 index 5f44428824b..00000000000 --- a/misc/nydusify-smoke/entrypoint.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -TEST_NAME=$1 - -dockerd-entrypoint.sh & sleep 50 -mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 -../nydusify-smoke -test.run $TEST_NAME