Skip to content

Commit

Permalink
add unit test and remove unused code
Browse files Browse the repository at this point in the history
Signed-off-by: huanghaoyuanhhy <[email protected]>
  • Loading branch information
huanghaoyuanhhy committed Jan 17, 2025
1 parent 312e7e9 commit 1b0f63f
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 1,039 deletions.
1 change: 1 addition & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pull_request_rules:

- name: Test passed for code changed-main
conditions:
- check-success=Unit test go
- check-success=Backup and restore cross version (docker-compose, standalone, standalone, 2.3-latest, master-latest)
- check-success=Backup and restore cross version (docker-compose, standalone, standalone, 2.3-latest, 2.4-latest)
- check-success=Backup and restore cross version (docker-compose, standalone, standalone, 2.4-latest, master-latest)
Expand Down
35 changes: 29 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,30 @@ on:
schedule:
- cron: '0 0 * * *'


env:
go-version: 1.23

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
unit-test-go:
name: Unit test go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go ${{ env.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
cache: go
- name: Unit test
run: make test

test-backup-restore-cross-version:
needs: unit-test-go
name: Backup and restore cross version
runs-on: ubuntu-latest
strategy:
Expand All @@ -41,8 +59,9 @@ jobs:
cache: pip

- uses: actions/setup-go@v3
name: Set up Go ${{ env.go-version }}
with:
go-version: '1.23'
go-version: ${{ env.go-version }}
cache: true

- name: Build
Expand All @@ -62,7 +81,6 @@ jobs:
sudo chmod +x /usr/local/bin/docker-compose
- name: Milvus deploy

timeout-minutes: 15
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
Expand Down Expand Up @@ -157,6 +175,7 @@ jobs:
python example/verify_data.py
test-backup-restore-after-upgrade:
needs: unit-test-go
name: Backup and restore after upgrade
runs-on: ubuntu-latest
strategy:
Expand All @@ -181,8 +200,9 @@ jobs:
cache: pip

- uses: actions/setup-go@v3
name: Set up Go ${{ env.go-version }}
with:
go-version: '1.23'
go-version: ${{ env.go-version }}
cache: true

- name: Build
Expand Down Expand Up @@ -251,6 +271,7 @@ jobs:
test-backup-restore-cli:
needs: unit-test-go
name: Backup and restore cli
runs-on: ubuntu-latest
strategy:
Expand All @@ -272,8 +293,9 @@ jobs:
cache: pip

- uses: actions/setup-go@v3
name: Set up Go ${{ env.go-version }}
with:
go-version: '1.23'
go-version: ${{ env.go-version }}
cache: true

- name: Build
Expand Down Expand Up @@ -386,6 +408,7 @@ jobs:
python example/verify_data.py
test-backup-restore-with-rbac-config:
needs: unit-test-go
name: Backup and restore with rbac config
runs-on: ubuntu-latest
strategy:
Expand All @@ -406,7 +429,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '1.23'
go-version: ${{ env.go-version }}
cache: "true"

- name: Creating kind cluster
Expand Down Expand Up @@ -555,7 +578,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '1.23'
go-version: ${{ env.go-version }}
cache: true

- name: Build
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ LDFLAGS += -X "$(PKG)/version.Date=$(DATE)"
# Default target
all: gen build

test:
@echo "Running unit tests..."
@go test --race ./...

# Build the binary
build:
@echo "Building Backup binary..."
Expand Down
2 changes: 1 addition & 1 deletion core/backup_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func paramsToCfg(params *paramtable.BackupParams) (*client.Cfg, error) {
}

cfg := &client.Cfg{
Address: ep,
Host: ep,
EnableTLS: enableTLS,
Username: params.MilvusCfg.User,
Password: params.MilvusCfg.Password,
Expand Down
Loading

0 comments on commit 1b0f63f

Please sign in to comment.