Skip to content

Commit

Permalink
E2E test vpc controller (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Kovacs <[email protected]>
  • Loading branch information
mhmxs and Richard Kovacs authored Feb 9, 2024
1 parent 660e466 commit 24de647
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions controller/linodevpc_controller_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (r *LinodeVPCReconciler) reconcileVPC(ctx context.Context, vpcScope *scope.
return err
}

vpcScope.LinodeVPC.Spec.Label = vpc.Label
vpcScope.LinodeVPC.Spec.VPCID = &vpc.ID

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/linodemachine-controller/byovpc/01-create-vpc.tpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ metadata:
cluster.x-k8s.io/paused: "true"
name: linodevpc-sample
spec:
label: capli-e2e-byovpc-sample
label: capli-e2e-byovpc-for-all-tests
region: us-sea
vpcID: ${VPC_ID}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"label": "capli-e2e-byovpc-sample",
"label": "capli-e2e-byovpc-for-all-tests",
"region": "us-sea",
"subnets": [
{
"ipv4": "10.0.0.0/24",
"label": "capli-e2e-byovpc-sample"
"label": "capli-e2e-byovpc-for-all-tests"
}
]
}
4 changes: 2 additions & 2 deletions e2e/linodemachine-controller/byovpc/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include ../../Makefile

createVPC:
@URI=vpcs FILTER='{"label":"capli-e2e-byovpc-sample"}' make --no-print-directory callLinodeApiGet | grep -v 'results": 0' ||\
@URI=vpcs FILTER='{"label":"capli-e2e-byovpc-for-all-tests"}' make --no-print-directory callLinodeApiGet | grep -v 'results": 0' ||\
URI=vpcs BODY='@01-vpc-create-options.json' make --no-print-directory callLinodeApiPost

enableVPC:
PATCH='{"status":{"ready":true}}' OBJ="linodevpcs/linodevpc-sample" make --no-print-directory patchKubeObjStatus

fetchVPCID:
@URI=vpcs FILTER='{"label":"capli-e2e-byovpc-sample"}' make --no-print-directory callLinodeApiGet | jq -r .data[0].id
@URI=vpcs FILTER='{"label":"capli-e2e-byovpc-for-all-tests"}' make --no-print-directory callLinodeApiGet | jq -r .data[0].id
9 changes: 9 additions & 0 deletions e2e/linodevpc-controller/minimal/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeVPC
metadata:
name: linodevpc-sample
spec:
label: capli-e2e-byovpc-sample
region: us-sea
status:
ready: true
7 changes: 7 additions & 0 deletions e2e/linodevpc-controller/minimal/01-create-vpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeVPC
metadata:
name: linodevpc-sample
spec:
label: capli-e2e-byovpc-sample
region: us-sea
6 changes: 6 additions & 0 deletions e2e/linodevpc-controller/minimal/02-delete-vpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeVPC
name: linodevpc-sample
7 changes: 7 additions & 0 deletions e2e/linodevpc-controller/minimal/02-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeVPC
metadata:
name: linodevpc-sample
spec:
label: capli-e2e-byovpc-sample
region: us-sea
5 changes: 5 additions & 0 deletions e2e/linodevpc-controller/minimal/03-verify-vpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
URI="vpcs" FILTER="{\"label\":\"CLi-$(OBJ=linodevpcs/linodevpc-sample make getKubeUid | sed 's/-//g')\"}" make callLinodeApiGet | grep 'results": 0'
1 change: 1 addition & 0 deletions e2e/linodevpc-controller/minimal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile

0 comments on commit 24de647

Please sign in to comment.