Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): Add self-hosted e2e test #439

Merged
merged 8 commits into from
Apr 29, 2024
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
24 changes: 23 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,37 @@ jobs:
with:
test-results: test.json

e2e-test:
e2e-quick-start:
strategy:
matrix:
provider:
- Docker
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
# - AWS
jimmidyson marked this conversation as resolved.
Show resolved Hide resolved
# - Nutanix
fail-fast: false
uses: ./.github/workflows/e2e.yml
with:
provider: ${{ matrix.provider }}
focus: Quick start
secrets: inherit
permissions:
contents: read
checks: write

e2e-self-hosted:
strategy:
matrix:
provider:
- Docker
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
# - AWS
# - Nutanix
fail-fast: false
uses: ./.github/workflows/e2e.yml
with:
provider: ${{ matrix.provider }}
focus: Self-hosted
secrets: inherit
permissions:
contents: read
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
description: Infrastructure provider to run e2e tests with
type: string
required: true
skip:
description: e2e tests to skip
type: string
focus:
description: e2e tests to focus
type: string

jobs:
e2e-test:
Expand Down Expand Up @@ -37,7 +43,7 @@ jobs:
${{ runner.os }}-go-
- name: Run e2e tests
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}'
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
7 changes: 4 additions & 3 deletions common/pkg/capi/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
"context"
"fmt"

v1 "k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// ManagementCluster returns a Cluster object if c is pointing to a management cluster, otherwise returns nil.
func ManagementCluster(ctx context.Context, c client.Client) (*clusterv1.Cluster, error) {
allNodes := &v1.NodeList{}
allNodes := &corev1.NodeList{}
err := c.List(ctx, allNodes)
if err != nil {
return nil, fmt.Errorf("error listing Nodes: %w", err)
Expand All @@ -37,7 +38,7 @@ func ManagementCluster(ctx context.Context, c client.Client) (*clusterv1.Cluster
}
err = c.Get(ctx, key, cluster)
if err != nil {
if k8serrors.IsNotFound(err) {
if k8serrors.IsNotFound(err) || meta.IsNoMatchError(err) {
return nil, nil
}
return nil, fmt.Errorf("error getting Cluster object based on Node annotations: %w", err)
Expand Down
Loading
Loading