Skip to content

Commit

Permalink
feat: add e2e to rust client
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <gaius.qi@gmail.com>
  • Loading branch information
gaius-qi committed Apr 18, 2024
1 parent 4abb179 commit 17f55ca
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main, release-*]
pull_request:
branches: [main, release-*]
branches: [amain, release-*]

env:
GO_VERSION: '1.21'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
pull_request:
branches: [ main, release-* ]
branches: [amain, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
schedule:
- cron: '0 4 * * *'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
pull_request:
branches: [main, release-*]
branches: [amain, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
schedule:
- cron: '0 4 * * *'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compatibility-e2e-with-client-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main, release-*]
paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"]
pull_request:
branches: [main, release-*]
branches: [amain, release-*]
paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"]
schedule:
- cron: '0 4 * * *'
Expand Down
77 changes: 39 additions & 38 deletions .github/workflows/e2e-with-client-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
charts-config: test/testdata/charts/config-rs.yaml
skip: ""
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: false
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# docker-images: true
# swap-storage: true

- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -74,11 +74,11 @@ jobs:
- name: Pull Rust Client Image
run: |
cd client-rs
# TODO Use the latest tag.
# CLIENT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
CLIENT_TAG=latest
CLIENT_TAG=$(git describe --tags $(git rev-parse HEAD))
docker pull dragonflyoss/client:$CLIENT_TAG
docker tag dragonflyoss/client:$CLIENT_TAG dragonflyoss/client:latest
docker pull dragonflyoss/dfinit:$CLIENT_TAG
docker tag dragonflyoss/dfinit:$CLIENT_TAG dragonflyoss/dfinit:latest
- name: Build Scheduler Image
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -114,13 +114,14 @@ jobs:
kind load docker-image dragonflyoss/manager:latest
kind load docker-image dragonflyoss/scheduler:latest
kind load docker-image dragonflyoss/client:latest
kind load docker-image dragonflyoss/dfinit:latest
# TODO Setup dragonfly
# - name: Setup dragonfly
# run: |
# helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system -f ${{ matrix.charts-config }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
# kubectl apply -f ${{ env.DRAGONFLY_FILE_SERVER_PATH }}
# kubectl wait po file-server-0 --namespace dragonfly-e2e --for=condition=ready --timeout=10m
- name: Setup dragonfly
run: |
helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system -f ${{ matrix.charts-config }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
kubectl apply -f ${{ env.DRAGONFLY_FILE_SERVER_PATH }}
kubectl wait po file-server-0 --namespace dragonfly-e2e --for=condition=ready --timeout=10m
kubectl get po -n dragonfly-system
# TODO Run tests
# - name: Run E2E test
Expand All @@ -129,22 +130,22 @@ jobs:
# --feature-gates=dfget-range=true,dfget-open-range=true,dfget-empty-file=true,dfget-recursive=true
# cat coverprofile.out >> coverage.txt

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
flags: e2etests

- name: Upload Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.module }}-e2e-tests-logs
path: |
/tmp/artifact/**/*.log
# - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.txt
# flags: e2etests

# - name: Upload Logs
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: ${{ matrix.module }}-e2e-tests-logs
# path: |
# /tmp/artifact/**/*.log
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main, release-*]
pull_request:
branches: [main, release-*]
branches: [amain, release-*]

env:
GO_VERSION: '1.21'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nydus-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main, release-*]
paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"]
pull_request:
branches: [main, release-*]
branches: [amain, release-*]
paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"]
schedule:
- cron: '0 4 * * *'
Expand Down
2 changes: 1 addition & 1 deletion client-rs
Submodule client-rs updated 50 files
+85 −3 .github/workflows/docker.yml
+21 −1 .github/workflows/release.yml
+1 −1 CONTRIBUTING.md
+155 −110 Cargo.lock
+38 −17 Cargo.toml
+1 −1 README.md
+3 −0 dragonfly-client-backend/Cargo.toml
+75 −90 dragonfly-client-backend/src/http.rs
+96 −0 dragonfly-client-backend/src/lib.rs
+2 −1 dragonfly-client-config/Cargo.toml
+12 −6 dragonfly-client-config/src/dfdaemon.rs
+405 −0 dragonfly-client-config/src/dfinit.rs
+1 −0 dragonfly-client-config/src/lib.rs
+0 −14 dragonfly-client-core/Cargo.toml
+235 −0 dragonfly-client-core/src/error/errors.rs
+59 −0 dragonfly-client-core/src/error/message.rs
+187 −0 dragonfly-client-core/src/error/mod.rs
+4 −247 dragonfly-client-core/src/lib.rs
+19 −0 dragonfly-client-core/src/result.rs
+27 −0 dragonfly-client-init/Cargo.toml
+39 −0 dragonfly-client-init/Dockerfile
+101 −0 dragonfly-client-init/src/bin/main.rs
+220 −0 dragonfly-client-init/src/container_runtime/containerd.rs
+111 −0 dragonfly-client-init/src/container_runtime/crio.rs
+53 −0 dragonfly-client-init/src/container_runtime/docker.rs
+125 −0 dragonfly-client-init/src/container_runtime/mod.rs
+17 −0 dragonfly-client-init/src/lib.rs
+2 −0 dragonfly-client-storage/src/content.rs
+1 −1 dragonfly-client-storage/src/lib.rs
+134 −71 dragonfly-client-storage/src/metadata.rs
+15 −9 dragonfly-client-util/src/http/mod.rs
+5 −2 dragonfly-client-util/src/id_generator/mod.rs
+15 −7 dragonfly-client-util/src/tls/mod.rs
+2 −2 dragonfly-client/Cargo.toml
+5 −2 dragonfly-client/Dockerfile
+1 −10 dragonfly-client/src/bin/dfdaemon/main.rs
+2 −1 dragonfly-client/src/bin/dfget/main.rs
+1 −1 dragonfly-client/src/dynconfig/mod.rs
+55 −17 dragonfly-client/src/grpc/dfdaemon_download.rs
+212 −56 dragonfly-client/src/grpc/dfdaemon_upload.rs
+8 −3 dragonfly-client/src/grpc/health.rs
+7 −3 dragonfly-client/src/grpc/manager.rs
+56 −0 dragonfly-client/src/grpc/mod.rs
+32 −11 dragonfly-client/src/grpc/scheduler.rs
+6 −2 dragonfly-client/src/grpc/security.rs
+17 −0 dragonfly-client/src/proxy/header.rs
+56 −19 dragonfly-client/src/proxy/mod.rs
+248 −203 dragonfly-client/src/task/mod.rs
+54 −51 dragonfly-client/src/task/piece.rs
+21 −15 dragonfly-client/src/task/piece_collector.rs
24 changes: 20 additions & 4 deletions test/testdata/charts/config-rs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ seedClient:
path: /tmp/artifact
config:
dynconfig:
refreshInterval: 1s
refreshInterval: 2s
scheduler:
announceInterval: 1s
announceInterval: 2s
log:
level: info

Expand All @@ -110,11 +110,27 @@ client:
- name: artifact
hostPath:
path: /tmp/artifact
dfinit:
enable: true
image:
repository: dragonflyoss/dfinit
tag: latest
config:
containerRuntime:
containerd:
configPath: /etc/containerd/config.toml
registries:
- hostNamespace: docker.io
serverAddr: https://index.docker.io
capabilities: ["pull", "resolve"]
- hostNamespace: ghcr.io
serverAddr: https://ghcr.io
capabilities: ["pull", "resolve"]
config:
dynconfig:
refreshInterval: 1s
refreshInterval: 2s
scheduler:
announceInterval: 1s
announceInterval: 2s
log:
level: info

Expand Down
7 changes: 0 additions & 7 deletions test/testdata/containerd/config-rs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,3 @@ version = 2
tolerate_missing_hugepages_controller = true
# restrict_oom_score_adj needs to be true when running inside UserNS (rootless)
restrict_oom_score_adj = false

# Mirrors use d7y.io instead of docker.io.
# when using docker.io to generate an endpoint, https://index.docker.io will be returned by default.
# https://github.com/containerd/containerd/blob/main/pkg/cri/server/image_pull.go#L456
# https://github.com/containerd/containerd/blob/main/remotes/docker/resolver.go#L121
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."d7y.io"]
endpoint = ["http://127.0.0.1:4001"]
3 changes: 1 addition & 2 deletions test/testdata/k8s/file-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ spec:
spec:
containers:
- name: nginx
# Pull image with dragonfly
image: d7y.io/library/nginx:1.21.1-alpine
image: nginx:1.21.1-alpine
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 80
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/kind/config-rs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ nodes:
hostPort: 4001
protocol: TCP
extraMounts:
- hostPath: ./test/testdata/containerd/config.toml
- hostPath: ./test/testdata/containerd/config-rs.toml
containerPath: /etc/containerd/config.toml
- hostPath: /tmp/artifact
containerPath: /tmp/artifact
Expand Down

0 comments on commit 17f55ca

Please sign in to comment.