Skip to content

Commit 3ad5620

Browse files
jimmidysondkoshkin
andauthored
test(e2e): Add self-hosted e2e test (#439)
Creating as draft until kubernetes-sigs/cluster-api-addon-provider-helm#189 is merged and released. Depends on #494. --------- Co-authored-by: Dimitri Koshkin <[email protected]>
1 parent 64e269f commit 3ad5620

12 files changed

+972
-1242
lines changed

.github/workflows/checks.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,37 @@ jobs:
5454
with:
5555
test-results: test.json
5656

57-
e2e-test:
57+
e2e-quick-start:
5858
strategy:
5959
matrix:
6060
provider:
6161
- Docker
62+
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
63+
# - AWS
64+
# - Nutanix
6265
fail-fast: false
6366
uses: ./.github/workflows/e2e.yml
6467
with:
6568
provider: ${{ matrix.provider }}
69+
focus: Quick start
70+
secrets: inherit
71+
permissions:
72+
contents: read
73+
checks: write
74+
75+
e2e-self-hosted:
76+
strategy:
77+
matrix:
78+
provider:
79+
- Docker
80+
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
81+
# - AWS
82+
# - Nutanix
83+
fail-fast: false
84+
uses: ./.github/workflows/e2e.yml
85+
with:
86+
provider: ${{ matrix.provider }}
87+
focus: Self-hosted
6688
secrets: inherit
6789
permissions:
6890
contents: read

.github/workflows/e2e.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
description: Infrastructure provider to run e2e tests with
99
type: string
1010
required: true
11+
skip:
12+
description: e2e tests to skip
13+
type: string
14+
focus:
15+
description: e2e tests to focus
16+
type: string
1117

1218
jobs:
1319
e2e-test:
@@ -37,7 +43,7 @@ jobs:
3743
${{ runner.os }}-go-
3844
3945
- name: Run e2e tests
40-
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}'
46+
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
4147
env:
4248
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4349
NUTANIX_ENDPOINT: ${{ secrets.NUTANIX_ENDPOINT }}

common/pkg/capi/utils/utils.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import (
77
"context"
88
"fmt"
99

10-
v1 "k8s.io/api/core/v1"
10+
corev1 "k8s.io/api/core/v1"
1111
k8serrors "k8s.io/apimachinery/pkg/api/errors"
12+
"k8s.io/apimachinery/pkg/api/meta"
1213
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
1314
"sigs.k8s.io/controller-runtime/pkg/client"
1415
)
1516

1617
// ManagementCluster returns a Cluster object if c is pointing to a management cluster, otherwise returns nil.
1718
func ManagementCluster(ctx context.Context, c client.Client) (*clusterv1.Cluster, error) {
18-
allNodes := &v1.NodeList{}
19+
allNodes := &corev1.NodeList{}
1920
err := c.List(ctx, allNodes)
2021
if err != nil {
2122
return nil, fmt.Errorf("error listing Nodes: %w", err)
@@ -37,7 +38,7 @@ func ManagementCluster(ctx context.Context, c client.Client) (*clusterv1.Cluster
3738
}
3839
err = c.Get(ctx, key, cluster)
3940
if err != nil {
40-
if k8serrors.IsNotFound(err) {
41+
if k8serrors.IsNotFound(err) || meta.IsNoMatchError(err) {
4142
return nil, nil
4243
}
4344
return nil, fmt.Errorf("error getting Cluster object based on Node annotations: %w", err)

0 commit comments

Comments
 (0)