Skip to content

Commit 6ace52e

Browse files
authored
feat: compatibility e2e with matrix (#599)
Signed-off-by: Gaius <[email protected]>
1 parent b3f7ba3 commit 6ace52e

File tree

5 files changed

+39
-52
lines changed

5 files changed

+39
-52
lines changed

.github/workflows/compatibility-e2e.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ env:
1212
CONTAINERD_VERSION: v1.5.2
1313
GOPROXY: https://goproxy.io,direct
1414
KIND_CONFIG_PATH: test/testdata/kind/config.yaml
15-
DRAGONFLY_E2E_TEST_MODE: compatibility
16-
DRAGONFLY_DFDAEMON_IMAGE: dragonflyoss/dfdaemon:v0.4.0
15+
DRAGONFLY_STABLE_IMAGE_TAG: v0.4.0
1716
DRAGONFLY_CHARTS_PATH: deploy/helm-charts/charts/dragonfly
18-
DRAGONFLY_CHARTS_CONFIG_PATH: test/testdata/charts/compatibility-config.yaml
17+
DRAGONFLY_CHARTS_CONFIG_PATH: test/testdata/charts/config.yaml
1918
DRAGONFLY_FILE_SERVER_PATH: test/testdata/k8s/file-server.yaml
2019

2120
jobs:
@@ -32,8 +31,12 @@ jobs:
3231
paths_ignore: '["**.md", "**.png", "**.jpg", "**.svg"]'
3332
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
3433

35-
e2e_tests:
34+
compatibility_e2e_tests:
35+
name: e2e_tests_with_${{ matrix.module }}
3636
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
module: ["manager", "scheduler", "cdn", "dfdaemon"]
3740
needs: skip_check
3841
if: needs.skip_check.outputs.noop != 'true'
3942

@@ -62,37 +65,35 @@ jobs:
6265

6366
- name: Build images
6467
run: |
65-
make docker-build-manager
66-
make docker-build-cdn
67-
make docker-build-scheduler
68-
docker pull ${{ env.DRAGONFLY_DFDAEMON_IMAGE }}
68+
make docker-build
69+
docker pull dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }}
6970
7071
- name: Prepare kind environment
7172
run: |
72-
make kind-load-manager
73-
make kind-load-cdn
74-
make kind-load-scheduler
75-
kind load docker-image ${{ env.DRAGONFLY_DFDAEMON_IMAGE }}
73+
make kind-load
74+
kind load docker-image dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }}
7675
7776
- name: Setup dragonfly
7877
run: |
79-
helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system -f ${{ env.DRAGONFLY_CHARTS_CONFIG_PATH }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
78+
helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system --set ${{ matrix.module }}.tag=${{ env.DRAGONFLY_STABLE_IMAGE_TAG }} --set ${{ matrix.module }}.image=dragonflyoss/${{ matrix.module }} -f ${{ env.DRAGONFLY_CHARTS_CONFIG_PATH }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
8079
kubectl apply -f ${{ env.DRAGONFLY_FILE_SERVER_PATH }}
8180
kubectl wait po file-server-0 --namespace dragonfly-e2e --for=condition=ready --timeout=10m
8281
83-
- name: Run compatibility E2E test
82+
- name: Run Compatibility E2E test
83+
env:
84+
DRAGONFLY_COMPATIBILITY_E2E_TEST_MODE: ${{ matrix.module }}
8485
run: make actions-e2e-test-coverage
8586

8687
- name: Upload coverage to Codecov
8788
uses: codecov/codecov-action@v1
8889
with:
8990
token: ${{ secrets.CODECOV_TOKEN }}
9091
files: ./coverage.txt
91-
flags: compatibility-e2etests
92+
flags: ${{ matrix }}-compatibility-e2etests
9293

9394
- name: Upload Logs
9495
uses: actions/upload-artifact@v2
9596
if: failure()
9697
with:
97-
name: dragonfly-logs
98+
name: ${{ matrix.module }}-compatibility-e2e-tests-logs
9899
path: /tmp/artifact/

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ jobs:
8484
uses: actions/upload-artifact@v2
8585
if: failure()
8686
with:
87-
name: dragonfly-logs
87+
name: e2e-tests-logs
8888
path: /tmp/artifact/

test/e2e/e2e_test.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,22 @@ const (
3636
)
3737

3838
const (
39-
compatibilityTestMode = "compatibility"
39+
dfdaemonCompatibilityTestMode = "dfdaemon"
4040
)
4141

4242
var _ = BeforeSuite(func() {
43+
mode := os.Getenv("DRAGONFLY_COMPATIBILITY_E2E_TEST_MODE")
44+
if mode != "" {
45+
rawImages, err := e2eutil.KubeCtlCommand("-n", dragonflyNamespace, "get", "pod", "-l", fmt.Sprintf("component=%s", mode),
46+
"-o", "jsonpath='{range .items[0]}{.spec.containers[0].image}{end}'").CombinedOutput()
47+
image := strings.Trim(string(rawImages), "'")
48+
Expect(err).NotTo(HaveOccurred())
49+
fmt.Printf("special image name: %s\n", image)
50+
51+
stableImageTag := os.Getenv("DRAGONFLY_STABLE_IMAGE_TAG")
52+
Expect(fmt.Sprintf("dragonflyoss/%s:%s", mode, stableImageTag)).To(Equal(image))
53+
}
54+
4355
rawGitCommit, err := e2eutil.GitCommand("rev-parse", "--short", "HEAD").CombinedOutput()
4456
Expect(err).NotTo(HaveOccurred())
4557
gitCommit := strings.Fields(string(rawGitCommit))[0]
@@ -57,8 +69,7 @@ var _ = BeforeSuite(func() {
5769
dfgetGitCommit := strings.Fields(string(rawDfgetVersion))[7]
5870
fmt.Printf("dfget merge commit: %s\n", dfgetGitCommit)
5971

60-
mode := os.Getenv("DRAGONFLY_E2E_TEST_MODE")
61-
if mode == compatibilityTestMode {
72+
if mode == dfdaemonCompatibilityTestMode {
6273
Expect(gitCommit).NotTo(Equal(dfgetGitCommit))
6374
return
6475
}
@@ -74,6 +85,12 @@ var _ = AfterSuite(func() {
7485
Expect(strings.HasPrefix(podName, "dragonfly-dfdaemon-")).Should(BeTrue())
7586

7687
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, podName, "/var/log/dragonfly/daemon/core.log", "/tmp/artifact/daemon.log").CombinedOutput()
88+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-0", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-0.log").CombinedOutput()
89+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-0", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-0.log").CombinedOutput()
90+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-1", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-1.log").CombinedOutput()
91+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-1", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-1.log").CombinedOutput()
92+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-2", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-2.log").CombinedOutput()
93+
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-2", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-2.log").CombinedOutput()
7794
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-0", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-0.log").CombinedOutput()
7895
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-1", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-1.log").CombinedOutput()
7996
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-2", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-2.log").CombinedOutput()

test/testdata/charts/compatibility-config.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)