Skip to content

Commit

Permalink
add e2e case
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jan 11, 2023
1 parent 23b9d86 commit 7cfe0cc
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 43 deletions.
117 changes: 88 additions & 29 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,21 @@ jobs:
- name: Cleanup
run: sh dist/images/cleanup.sh

kube-ovn-ic-conformance-e2e:
name: Kube-OVN IC Conformance E2E
ovn-ha-conformance-e2e:
name: OVN HA Conformance E2E
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ssl:
- "true"
- "false"
ip-family:
- ipv4
- ipv6
- dual
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -518,29 +528,77 @@ jobs:
- name: Load image
run: docker load --input kube-ovn.tar

- name: Create kind clusters
- name: Create kind cluster
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init-ovn-ic
sudo PATH=~/.local/bin:$PATH make kind-init-ha-${{ matrix.ip-family }}
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN
run: make kind-install-ovn-ic
env:
ENABLE_SSL: ${{ matrix.ssl }}
run: make kind-install-${{ matrix.ip-family }}

- name: Run E2E
working-directory: ${{ env.E2E_DIR }}
run: make kube-ovn-ic-conformance-e2e
env:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
E2E_IP_FAMILY: ${{ matrix.ip-family }}
run: make kube-ovn-conformance-e2e

chart-installation-test:
- name: Cleanup
run: sh dist/images/cleanup.sh

kube-ovn-ic-conformance-e2e:
name: Kube-OVN IC Conformance E2E
needs: build-kube-ovn
name: Chart Installation Test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

- name: Create the default branch directory
run: mkdir -p test/e2e/source

- name: Check out the default branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 1
path: test/e2e/source

- name: Export E2E directory
run: |
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
echo "E2E_DIR=." >> "$GITHUB_ENV"
else
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
fi
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
Expand All @@ -555,27 +613,24 @@ jobs:
- name: Load image
run: docker load --input kube-ovn.tar

- name: Create kind cluster
- name: Create kind clusters
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init
sudo PATH=~/.local/bin:$PATH make kind-init-ovn-ic
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN
run: |
make kind-install-chart
kubectl rollout status deployment/ovn-central -n kube-system --timeout 300s
kubectl rollout status deployment/kube-ovn-controller -n kube-system --timeout 300s
kubectl rollout status daemonset/kube-ovn-cni -n kube-system --timeout 300s
run: make kind-install-ovn-ic

- name: Cleanup
run: sh dist/images/cleanup.sh
- name: Run E2E
working-directory: ${{ env.E2E_DIR }}
run: make kube-ovn-ic-conformance-e2e

ha-installation-test:
chart-installation-test:
name: Chart Installation Test
needs: build-kube-ovn
name: HA Installation Test
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand All @@ -599,19 +654,23 @@ jobs:
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init-ha
sudo PATH=~/.local/bin:$PATH make kind-init
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN
run: sudo ENABLE_SSL=true make kind-install
run: |
make kind-install-chart
kubectl rollout status deployment/ovn-central -n kube-system --timeout 300s
kubectl rollout status deployment/kube-ovn-controller -n kube-system --timeout 300s
kubectl rollout status daemonset/kube-ovn-cni -n kube-system --timeout 300s
- name: Cleanup
run: sh dist/images/cleanup.sh

underlay-logical-gateway-installation-test:
needs: build-kube-ovn
name: Underlay Logical Gateway Installation Test
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -646,8 +705,8 @@ jobs:
run: sh dist/images/cleanup.sh

no-ovn-lb-test:
needs: build-kube-ovn
name: Disable OVN LB Test
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -684,8 +743,8 @@ jobs:
run: sh dist/images/cleanup.sh

no-np-test:
needs: build-kube-ovn
name: Disable Network Policy Test
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -722,10 +781,10 @@ jobs:
run: sh dist/images/cleanup.sh

lb-svc-e2e:
name: LB Service E2E
needs:
- build-kube-ovn
- build-vpc-nat-gateway
name: LB Service E2E
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -811,8 +870,8 @@ jobs:
run: make kube-ovn-lb-svc-conformance-e2e

installation-compatibility-test:
needs: build-kube-ovn
name: Installation Compatibility Test
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
Expand Down Expand Up @@ -847,8 +906,8 @@ jobs:
run: sh dist/images/cleanup.sh

cilium-chaining-e2e:
needs: build-kube-ovn
name: Cilium Chaining E2E
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -935,22 +994,22 @@ jobs:
run: sh dist/images/cleanup.sh

push:
name: Push Images
needs:
- build-centos-compile
- k8s-conformance-e2e
# - k8s-netpol-e2e
- cyclonus-netpol-e2e
- kube-ovn-conformance-e2e
- ovn-ha-conformance-e2e
- kube-ovn-ic-conformance-e2e
- lb-svc-e2e
- ha-installation-test
- underlay-logical-gateway-installation-test
- chart-installation-test
- installation-compatibility-test
- no-ovn-lb-test
- no-np-test
- cilium-chaining-e2e
name: push
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand Down
56 changes: 43 additions & 13 deletions .github/workflows/scheduled-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ jobs:
E2E_NETWORK_MODE: ${{ matrix.mode }}
run: make kube-ovn-conformance-e2e

kube-ovn-ic-conformance-e2e:
name: Kube-OVN IC Conformance E2E
ovn-ha-conformance-e2e:
name: OVN HA Conformance E2E
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand All @@ -324,6 +324,13 @@ jobs:
- master
- release-1.10
- release-1.9
ssl:
- "true"
- "false"
ip-family:
- ipv4
- ipv6
- dual
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down Expand Up @@ -365,24 +372,30 @@ jobs:
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init-ovn-ic
sudo PATH=~/.local/bin:$PATH make kind-init-ha-${{ matrix.ip-family }}
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN
working-directory: test/e2e/kube-ovn/branches/${{ matrix.branch }}
env:
ENABLE_SSL: ${{ matrix.ssl }}
run: |
version=$(grep -E '^VERSION="v([0-9]+\.){2}[0-9]+"$' dist/images/install.sh | head -n1 | awk -F= '{print $2}' | tr -d '"')
docker pull kubeovn/kube-ovn:$version
VERSION=$version make kind-install-ovn-ic
VERSION=$version make kind-install-${{ matrix.ip-family }}
- name: Run E2E
env:
E2E_BRANCH: ${{ matrix.branch }}
run: make kube-ovn-ic-conformance-e2e
E2E_IP_FAMILY: ${{ matrix.ip-family }}
run: make kube-ovn-conformance-e2e

- name: Cleanup
run: sh dist/images/cleanup.sh

ha-installation-test:
name: HA Installation Test
kube-ovn-ic-conformance-e2e:
name: Kube-OVN IC Conformance E2E
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand All @@ -392,9 +405,25 @@ jobs:
- master
- release-1.10
- release-1.9
- release-1.8
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Create branch directory
run: mkdir -p test/e2e/kube-ovn/branches/${{ matrix.branch }}
Expand All @@ -417,7 +446,7 @@ jobs:
run: |
sudo pip3 install j2cli
sudo pip3 install "j2cli[yaml]"
sudo PATH=~/.local/bin:$PATH make kind-init-ha
sudo PATH=~/.local/bin:$PATH make kind-init-ovn-ic
sudo cp -r /root/.kube/ ~/.kube/
sudo chown -R $(id -un). ~/.kube/
Expand All @@ -426,11 +455,12 @@ jobs:
run: |
version=$(grep -E '^VERSION="v([0-9]+\.){2}[0-9]+"$' dist/images/install.sh | head -n1 | awk -F= '{print $2}' | tr -d '"')
docker pull kubeovn/kube-ovn:$version
sudo ENABLE_SSL=true VERSION=$version make kind-install
VERSION=$version make kind-install-ovn-ic
- name: Cleanup
working-directory: test/e2e/kube-ovn/branches/${{ matrix.branch }}
run: sh dist/images/cleanup.sh
- name: Run E2E
env:
E2E_BRANCH: ${{ matrix.branch }}
run: make kube-ovn-ic-conformance-e2e

underlay-logical-gateway-installation-test:
name: Underlay Logical Gateway Installation Test
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,20 @@ kind-init-iptables:
@kube_proxy_mode=iptables $(MAKE) kind-init

.PHONY: kind-init-ha
kind-init-ha:
kind-init-ha: kind-init-ha-ipv4

.PHONY: kind-init-ha-ipv4
kind-init-ha-ipv4:
@ha=true $(MAKE) kind-init

.PHONY: kind-init-ha-ipv6
kind-init-ha-ipv6:
@ip_family=ipv6 $(MAKE) kind-init-ha

.PHONY: kind-init-ha-dual
kind-init-ha-dual:
@ip_family=dual $(MAKE) kind-init-ha

.PHONY: kind-init-single
kind-init-single:
@single=true $(MAKE) kind-init
Expand Down
1 change: 1 addition & 0 deletions test/e2e/kube-ovn/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/kubectl-ko"
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/node"
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/qos"
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/security"
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/subnet"
_ "github.com/kubeovn/kube-ovn/test/e2e/kube-ovn/underlay"
)
Expand Down
Loading

0 comments on commit 7cfe0cc

Please sign in to comment.