Skip to content

Commit

Permalink
Merge pull request #4860 from werf/test-e2e-kube-run-tests-done
Browse files Browse the repository at this point in the history
test(e2e): kube-run tests done
  • Loading branch information
ilya-lesikov committed Sep 13, 2022
2 parents 81b4b81 + d308a99 commit 0c9504b
Show file tree
Hide file tree
Showing 17 changed files with 177 additions and 51 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/_test_e2e_per-k8s-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: xxxxx(internal)

on:
workflow_call:
inputs:
scope:
required: true
type: string
packages:
description: Comma-separated package paths to test
type: string
excludePackages:
description: Comma-separated package paths to exclude from testing
type: string
coverage:
default: false
type: string
forceSkip:
default: false
type: string

defaults:
run:
shell: bash

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
if: inputs.forceSkip == 'false'
strategy:
fail-fast: false
matrix:
k8s-version:
- major: 1
minor: 23
- major: 1
minor: 25
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Install system dependencies
run: sudo apt-get install -y libbtrfs-dev buildah

- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod

- name: Install Task
uses: arduino/setup-task@v1

- name: Set up prebuilt werf test binary
uses: ./.github/actions/set-up-prebuilt-werf-test-binary
with:
coverage: ${{ inputs.coverage }}
coverageDirSuffix: ubuntu-22.04

- name: Set up git config
uses: ./.github/actions/set-up-git-config

- name: Install ginkgo
run: task -p deps:install:ginkgo

- name: Test
run: |
source ./scripts/ci/integration_k8s_tests_before_hook.sh
test -n "${{ inputs.packages }}" && paths=paths="$(echo ${{ inputs.packages }} | tr , ' ')"
if ${{ inputs.coverage }}; then
task -p test:e2e:${{ inputs.scope }} $paths -- --coverprofile="$(openssl rand -hex 6)-coverage.out" --keep-going --skip-package '${{ inputs.excludePackages }}'
mv *-coverage.out "$WERF_TEST_COVERAGE_DIR/"
else
task -p test:e2e:${{ inputs.scope }} $paths -- --keep-going --skip-package '${{ inputs.excludePackages }}'
fi
echo loadavg: $(cat /proc/loadavg)
env:
WERF_TEST_K8S_BASE64_KUBECONFIG: ${{ secrets[format('WERF_TEST_K8S_BASE64_KUBECONFIG_{0}_{1}', matrix.k8s-version.major, matrix.k8s-version.minor)] }}
WERF_TEST_K8S_DOCKER_REGISTRY: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY }}
WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME }}
WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD }}

- if: inputs.coverage == 'true'
name: Upload coverage artifact
uses: actions/upload-artifact@master
with:
name: coverage
path: coverage
13 changes: 13 additions & 0 deletions .github/workflows/_test_e2e_regular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
excludePackages:
description: Comma-separated package paths to exclude from testing
type: string
k8sMajor:
default: 1
type: string
k8sMinor:
default: 25
type: string
coverage:
default: false
type: string
Expand All @@ -25,6 +31,7 @@ defaults:

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
Expand Down Expand Up @@ -61,6 +68,7 @@ jobs:

- name: Test
run: |
source ./scripts/ci/integration_k8s_tests_before_hook.sh
test -n "${{ inputs.packages }}" && paths=paths="$(echo ${{ inputs.packages }} | tr , ' ')"
if ${{ inputs.coverage }}; then
task -p test:e2e:${{ inputs.scope }} $paths -- --coverprofile="$(openssl rand -hex 6)-coverage.out" --keep-going --skip-package '${{ inputs.excludePackages }}'
Expand All @@ -69,6 +77,11 @@ jobs:
task -p test:e2e:${{ inputs.scope }} $paths -- --keep-going --skip-package '${{ inputs.excludePackages }}'
fi
echo loadavg: $(cat /proc/loadavg)
env:
WERF_TEST_K8S_BASE64_KUBECONFIG: ${{ secrets[format('WERF_TEST_K8S_BASE64_KUBECONFIG_{0}_{1}', inputs.k8sMajor, inputs.k8sMinor)] }}
WERF_TEST_K8S_DOCKER_REGISTRY: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY }}
WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME }}
WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD: ${{ secrets.WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD }}

- if: inputs.coverage == 'true'
name: Upload coverage artifact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defaults:

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defaults:

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_test_integration_per-k8s-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defaults:

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_test_integration_regular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defaults:

env:
DEBIAN_FRONTEND: "noninteractive"
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "false"

jobs:
_:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ jobs:
with:
coverage: true

e2e_simple:
uses: ./.github/workflows/_test_e2e_regular.yml
e2e_simple_per-k8s-version:
uses: ./.github/workflows/_test_e2e_per-k8s-version.yml
with:
scope: simple
secrets: inherit

e2e_complex:
uses: ./.github/workflows/_test_e2e_regular.yml
e2e_complex_per-k8s-version:
uses: ./.github/workflows/_test_e2e_per-k8s-version.yml
with:
scope: complex
secrets: inherit

e2e_extra:
uses: ./.github/workflows/_test_e2e_regular.yml
e2e_extra_per-k8s-version:
uses: ./.github/workflows/_test_e2e_per-k8s-version.yml
with:
scope: extra
secrets: inherit
Expand Down Expand Up @@ -85,9 +85,9 @@ jobs:
- integration_per-k8s
- integration_per-cr
- integration_per-k8s-and-cr
- e2e_simple
- e2e_complex
- e2e_extra
- e2e_simple_per-k8s-version
- e2e_complex_per-k8s-version
- e2e_extra_per-k8s-version
secrets: inherit

notify:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/test_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ jobs:
uses: ./.github/workflows/_test_integration_per-k8s-version.yml
secrets: inherit

e2e_complex:
e2e_simple_per-k8s:
if: github.event_name != 'pull_request' || github.event.label.name == 'trigger:\ test:main'
uses: ./.github/workflows/_test_e2e_regular.yml
uses: ./.github/workflows/_test_e2e_per-k8s-version.yml
with:
scope: simple
secrets: inherit

e2e_complex_per-k8s:
if: github.event_name != 'pull_request' || github.event.label.name == 'trigger:\ test:main'
uses: ./.github/workflows/_test_e2e_per-k8s-version.yml
with:
scope: complex
secrets: inherit
Expand All @@ -79,7 +86,8 @@ jobs:
- integration_git
- integration_ansible
- integration_per-k8s
- e2e_complex
- e2e_simple_per-k8s
- e2e_complex_per-k8s
uses: ./.github/workflows/_notification.yml
secrets:
mentionGroupID: ${{ secrets.SLACK_MENTION_GROUP_ID }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
with:
scope: simple
forceSkip: ${{ github.event_name == 'pull_request' && needs.detect-changes.outputs.workflow_proceed == 'false' }}
secrets: inherit

notify:
if: |
Expand Down
1 change: 1 addition & 0 deletions Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
WERF_TEST_K8S_DOCKER_REGISTRY: "localhost:5000"
WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME: "nobody"
WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD: ""
WERF_TEST_K8S_DOCKER_REGISTRY_INSECURE: "true"
GO111MODULE: "on"

vars:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/build/_fixtures/complex/state0/werf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project: test-werf-e2e-build-complex
project: werf-test-e2e-build-complex
configVersion: 1

---
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/build/_fixtures/complex/state1/werf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project: test-werf-e2e-build-complex
project: werf-test-e2e-build-complex
configVersion: 1

---
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/build/_fixtures/simple/state0/werf.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project: test-werf-e2e-build-simple
project: werf-test-e2e-build-simple
configVersion: 1

---
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/kube-run/_fixtures/simple/state0/werf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project: werf-test-e2e-kube-run-complex
configVersion: 1

---
image: main
from: ubuntu:22.04
6 changes: 0 additions & 6 deletions test/e2e/kube-run/_fixtures/state0/werf.yaml

This file was deleted.

0 comments on commit 0c9504b

Please sign in to comment.