Skip to content

Add step to e2e tests to clean up resources in the test NetBox instance #321

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,45 @@ spec:
tenant: MY_TENANT
customFields:
netboxOperatorRestorationHash: 00b8772de73cdac083b0732d5bb85ab4f0caa16c
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
name: prefixclaim-ipv4-parentprefix-restore-1
spec:
preserveInNetbox: false
- patch:
resource:
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
name: prefixclaim-ipv4-parentprefix-restore-2
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: Prefix
metadata:
name: prefixclaim-ipv4-parentprefix-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- assert:
resource:
apiVersion: netbox.dev/v1
kind: Prefix
metadata:
name: prefixclaim-ipv4-parentprefix-restore-2
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,27 @@ spec:
tenant: MY_TENANT_2
customFields:
netboxOperatorRestorationHash: 8a5e15cd391ec02a7a2b2e316bc163f4fe46ef0b
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
name: prefixclaim-ipv4-parentprefixselector-restore-1
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: Prefix
metadata:
name: prefixclaim-ipv4-parentprefixselector-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ spec:
tenant: MY_TENANT_2
customFields:
netboxOperatorRestorationHash: 46116345cc81820fdb412dc83e7147d4b1dc1afa
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
name: prefixclaim-ipv4-parentprefixselector-apply
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: Prefix
metadata:
name: prefixclaim-ipv4-parentprefixselector-apply
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,27 @@ spec:
prefix: 2::/124
preserveInNetbox: true
tenant: MY_TENANT_2
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: PrefixClaim
metadata:
name: prefixclaim-ipv6-apply-update
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: Prefix
metadata:
name: prefixclaim-ipv6-apply-update
status:
(conditions[?type == 'Ready']):
- observedGeneration: 3
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ spec:
status:
(conditions[?type == 'Ready']):
- status: 'True'
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: IpAddressClaim
metadata:
name: ipaddressclaim-ipv4-restore-1
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: IpAddress
metadata:
name: ipaddressclaim-ipv4-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ spec:
status:
(conditions[?type == 'Ready']):
- status: 'True'
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: IpAddressClaim
metadata:
name: ipaddressclaim-ipv6-restore-1
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: IpAddress
metadata:
name: ipaddressclaim-ipv6-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,27 @@ spec:
status:
(conditions[?type == 'Ready']):
- status: 'True'
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: IpRangeClaim
metadata:
name: iprangeclaim-ipv4-restore-1
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: IpRange
metadata:
name: iprangeclaim-ipv4-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events and leases
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource and lease cleanup for preventing delays when using the same prefixes (e.g. with "invalid" tests)
cleanup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,27 @@ spec:
status:
(conditions[?type == 'Ready']):
- status: 'True'
- name: Set preserveInNetbox to false
description: Set preserveInNetbox to false to clean up the NetBox test instance
try:
- patch:
resource:
apiVersion: netbox.dev/v1
kind: IpRangeClaim
metadata:
name: iprangeclaim-ipv6-restore-1
spec:
preserveInNetbox: false
- assert:
resource:
apiVersion: netbox.dev/v1
kind: IpRange
metadata:
name: iprangeclaim-ipv6-restore-1
status:
(conditions[?type == 'Ready']):
- observedGeneration: 2
status: 'True'
- name: Cleanup events and leases
description: Events cleanup required to fix issues with failing tests that assert the wrong Error resource and lease cleanup for preventing delays when using the same prefixes (e.g. with "invalid" tests)
cleanup:
Expand Down