Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nydusify: add unit test #1526

Merged
merged 4 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ jobs:
cache-dependency-path: "**/*.sum"
- name: Build Contrib
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.54.2
make -e DOCKER=false nydusify-release
- name: Upload Nydusify
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd/nydusify
Expand All @@ -48,7 +47,7 @@ jobs:
rustup component add rustfmt clippy
make
- name: Upload Nydus Binaries
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydus-artifact
path: |
Expand Down Expand Up @@ -87,12 +86,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down Expand Up @@ -134,12 +133,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down Expand Up @@ -180,12 +179,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down Expand Up @@ -226,12 +225,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/convert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.54.2
make -e DOCKER=false nydusify-release
- name: Upload Nydusify
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd/nydusify
Expand All @@ -49,7 +49,7 @@ jobs:
rustup component add rustfmt clippy
make
- name: Upload Nydus Binaries
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydus-artifact
path: |
Expand All @@ -68,7 +68,7 @@ jobs:
cd erofs-utils && git checkout v1.6 && git apply ../${{ env.FSCK_PATCH_PATH }} && ./autogen.sh && ./configure && make && cd ..
sudo cp erofs-utils/fsck/fsck.erofs /usr/local/bin/
- name: Upload fsck.erofs
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: fsck-erofs-artifact
path: |
Expand All @@ -87,17 +87,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: /usr/local/bin
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: /usr/local/bin
- name: Download fsck.erofs
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: fsck-erofs-artifact
path: /usr/local/bin
Expand Down Expand Up @@ -161,12 +161,12 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: /usr/local/bin
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: /usr/local/bin
Expand Down Expand Up @@ -215,17 +215,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: /usr/local/bin
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: /usr/local/bin
- name: Download fsck.erofs
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: fsck-erofs-artifact
path: /usr/local/bin
Expand Down Expand Up @@ -272,17 +272,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download Zran Metric
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: convert-zran-metric
path: convert-zran
- name: Download V5 Metric
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: convert-native-v5-metric
path: convert-native-v5
- name: Download V6 Metric
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: convert-native-v6-metric
path: convert-native-v6
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
make -e DOCKER=false GOARCH=${{ matrix.arch }} contrib-release
- name: Upload Nydusify
if: matrix.arch == 'amd64'
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
sudo mv target/$RUST_TARGET/release/nydus-image .
- name: Upload Nydus Binaries
if: matrix.arch == 'amd64'
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydus-artifact
path: |
Expand Down Expand Up @@ -108,13 +108,13 @@ jobs:
uses: jpribyl/[email protected]
continue-on-error: true
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: |
target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down Expand Up @@ -195,9 +195,9 @@ jobs:
- name: Unit Test
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin v1.54.2
make -e DOCKER=false contrib-test
sudo make -e DOCKER=false contrib-test
- name: Upload contrib coverage file
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: contrib-test-coverage-artifact
path: |
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
CARGO_BIN=$(which cargo)
sudo -E CARGO=${CARGO_BIN} make coverage-codecov
- name: Upload nydus coverage file
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: nydus-test-coverage-artifact
path: |
Expand All @@ -237,11 +237,11 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download nydus coverage file
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-test-coverage-artifact
- name: Download contrib coverage file
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: contrib-test-coverage-artifact
- name: Upload coverage to Codecov
Expand Down Expand Up @@ -271,12 +271,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nydus
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydus-artifact
path: target/release
- name: Download Nydusify
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: nydusify-artifact
path: contrib/nydusify/cmd
Expand Down
2 changes: 1 addition & 1 deletion contrib/ctr-remote/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build:
release:
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/ctr-remote ./cmd/main.go

test: build
test:
go vet $(PACKAGES)
golangci-lint run
go test -v -cover ${PACKAGES}
Expand Down
2 changes: 1 addition & 1 deletion contrib/nydus-overlayfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif
all: build

build:
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags="-s -w -X 'main.Version=${GIT_COMMIT}' -X 'main.BuildTime=${BUILD_TIME}'" -v -o bin/nydus-overlayfs ./cmd/main.go
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags="-s -w -X 'main.Version=${GIT_COMMIT}' -X 'main.BuildTime=${BUILD_TIME}'" -v -o bin/nydus-overlayfs ./cmd/main.go

release:
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/nydus-overlayfs ./cmd/main.go
Expand Down
6 changes: 3 additions & 3 deletions contrib/nydusify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ release:
plugin:
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -o nydus-hook-plugin ./plugin

test: build
test:
@go vet $(PACKAGES)
golangci-lint run
@go test -covermode=atomic -coverprofile=coverage.txt -count=1 -v -timeout 20m -race ${PACKAGES}
@go test -covermode=atomic -coverprofile=coverage.txt -count=1 -v -timeout 20m -parallel 16 -race ${PACKAGES}

coverage: test
@go tool cover -func=coverage.out
@go tool cover -func=coverage.txt

clean:
rm -f cmd/nydusify
Expand Down
Loading