Skip to content
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
33 changes: 17 additions & 16 deletions .github/workflows/compatibility-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ env:
CONTAINERD_VERSION: v1.5.2
GOPROXY: https://goproxy.io,direct
KIND_CONFIG_PATH: test/testdata/kind/config.yaml
DRAGONFLY_E2E_TEST_MODE: compatibility
DRAGONFLY_DFDAEMON_IMAGE: dragonflyoss/dfdaemon:v0.4.0
DRAGONFLY_STABLE_IMAGE_TAG: v0.4.0
DRAGONFLY_CHARTS_PATH: deploy/helm-charts/charts/dragonfly
DRAGONFLY_CHARTS_CONFIG_PATH: test/testdata/charts/compatibility-config.yaml
DRAGONFLY_CHARTS_CONFIG_PATH: test/testdata/charts/config.yaml
DRAGONFLY_FILE_SERVER_PATH: test/testdata/k8s/file-server.yaml

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

e2e_tests:
compatibility_e2e_tests:
name: e2e_tests_with_${{ matrix.module }}
runs-on: ubuntu-latest
strategy:
matrix:
module: ["manager", "scheduler", "cdn", "dfdaemon"]
needs: skip_check
if: needs.skip_check.outputs.noop != 'true'

Expand Down Expand Up @@ -62,37 +65,35 @@ jobs:

- name: Build images
run: |
make docker-build-manager
make docker-build-cdn
make docker-build-scheduler
docker pull ${{ env.DRAGONFLY_DFDAEMON_IMAGE }}
make docker-build
docker pull dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }}

- name: Prepare kind environment
run: |
make kind-load-manager
make kind-load-cdn
make kind-load-scheduler
kind load docker-image ${{ env.DRAGONFLY_DFDAEMON_IMAGE }}
make kind-load
kind load docker-image dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }}

- name: Setup dragonfly
run: |
helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system -f ${{ env.DRAGONFLY_CHARTS_CONFIG_PATH }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }}
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 }}
kubectl apply -f ${{ env.DRAGONFLY_FILE_SERVER_PATH }}
kubectl wait po file-server-0 --namespace dragonfly-e2e --for=condition=ready --timeout=10m

- name: Run compatibility E2E test
- name: Run Compatibility E2E test
env:
DRAGONFLY_COMPATIBILITY_E2E_TEST_MODE: ${{ matrix.module }}
run: make actions-e2e-test-coverage

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

- name: Upload Logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: dragonfly-logs
name: ${{ matrix.module }}-compatibility-e2e-tests-logs
path: /tmp/artifact/
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ jobs:
uses: actions/upload-artifact@v2
if: failure()
with:
name: dragonfly-logs
name: e2e-tests-logs
path: /tmp/artifact/
23 changes: 20 additions & 3 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,22 @@ const (
)

const (
compatibilityTestMode = "compatibility"
dfdaemonCompatibilityTestMode = "dfdaemon"
)

var _ = BeforeSuite(func() {
mode := os.Getenv("DRAGONFLY_COMPATIBILITY_E2E_TEST_MODE")
if mode != "" {
rawImages, err := e2eutil.KubeCtlCommand("-n", dragonflyNamespace, "get", "pod", "-l", fmt.Sprintf("component=%s", mode),
"-o", "jsonpath='{range .items[0]}{.spec.containers[0].image}{end}'").CombinedOutput()
image := strings.Trim(string(rawImages), "'")
Expect(err).NotTo(HaveOccurred())
fmt.Printf("special image name: %s\n", image)

stableImageTag := os.Getenv("DRAGONFLY_STABLE_IMAGE_TAG")
Expect(fmt.Sprintf("dragonflyoss/%s:%s", mode, stableImageTag)).To(Equal(image))
}

rawGitCommit, err := e2eutil.GitCommand("rev-parse", "--short", "HEAD").CombinedOutput()
Expect(err).NotTo(HaveOccurred())
gitCommit := strings.Fields(string(rawGitCommit))[0]
Expand All @@ -57,8 +69,7 @@ var _ = BeforeSuite(func() {
dfgetGitCommit := strings.Fields(string(rawDfgetVersion))[7]
fmt.Printf("dfget merge commit: %s\n", dfgetGitCommit)

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

e2eutil.KubeCtlCopyCommand(dragonflyNamespace, podName, "/var/log/dragonfly/daemon/core.log", "/tmp/artifact/daemon.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-0", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-0.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-0", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-0.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-1", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-1.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-1", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-1.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-2", "/var/log/dragonfly/manager/core.log", "/tmp/artifact/manager-2.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonlfy-manager-2", "/var/log/dragonfly/manager/gin.log", "/tmp/artifact/manager-gin-2.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-0", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-0.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-1", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-1.log").CombinedOutput()
e2eutil.KubeCtlCopyCommand(dragonflyNamespace, "dragonfly-cdn-2", "/var/log/dragonfly/cdn/core.log", "/tmp/artifact/cdn-2.log").CombinedOutput()
Expand Down
31 changes: 0 additions & 31 deletions test/testdata/charts/compatibility-config.yaml

This file was deleted.