Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattes83 committed Aug 27, 2024
1 parent d891113 commit 82098f9
Show file tree
Hide file tree
Showing 6 changed files with 527 additions and 2 deletions.
25 changes: 25 additions & 0 deletions test/e2e/capic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ package e2e
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"os"

clusterctlcluster "sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
capie2e "sigs.k8s.io/cluster-api/test/e2e"
"sigs.k8s.io/cluster-api/test/framework"
Expand Down Expand Up @@ -95,3 +97,26 @@ var _ = Describe("Should be able to create a cluster with 1 control-plane and 1
}
})
})

var _ = Describe("Should be able to create a cluster with 1 control-plane using an IP from the IPAddressPool", func() {
capie2e.QuickStartSpec(ctx, func() capie2e.QuickStartSpecInput {
return capie2e.QuickStartSpecInput{
E2EConfig: e2eConfig,
ControlPlaneMachineCount: ptr.To(int64(1)),
WorkerMachineCount: ptr.To(int64(0)),
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
Flavor: ptr.To("ipam"),
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
PostNamespaceCreated: cloudEnv.createCredentialsSecretPNC,
PostMachinesProvisioned: func(managementClusterProxy framework.ClusterProxy, namespace, clusterName string) {
machines := &infrav1.IonosCloudMachineList{}
Expect(managementClusterProxy.GetClient().List(ctx, machines, runtimeclient.InNamespace(namespace))).NotTo(HaveOccurred())
nic := machines.Items[0].Status.MachineNetworkInfo.NICInfo[0]
desired := os.Getenv("ADDITIONAL_IPS")
Expect(nic.IPv4Addresses).To(ContainElement(desired))
},
}
})
})
14 changes: 14 additions & 0 deletions test/e2e/config/ionoscloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ providers:
new: --metrics-addr=:8443
files:
- sourcePath: "../data/shared/v1.7/metadata.yaml"
- name: in-cluster
type: IPAMProvider
versions:
- name: "{go://sigs.k8s.io/[email protected]}" # supported release in the v1alpha2 series
# Use manifest from source files
value: "https://github.com/kubernetes-sigs/cluster-api-ipam-provider-in-cluster/releases/download/{go://sigs.k8s.io/[email protected]}/ipam-components.yaml"
type: url
contract: v1beta1
files:
- sourcePath: "../data/shared/capi-ipam/v0.1/metadata.yaml"
replacements:
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- name: ionoscloud
type: InfrastructureProvider
versions:
Expand All @@ -51,6 +64,7 @@ providers:
files:
- sourcePath: "../../../metadata.yaml"
- sourcePath: "../data/infrastructure-ionoscloud/cluster-template.yaml"
- sourcePath: "../data/infrastructure-ionoscloud/cluster-template-ipam.yaml"
variables:
# Default variables for the e2e test; those values could be overridden via env variables, thus
# allowing the same e2e config file to be re-used in different Prow jobs e.g. each one with a K8s version permutation.
Expand Down
Loading

0 comments on commit 82098f9

Please sign in to comment.