fix(netbox/test): test custom fields first (#7104)
More atomic and it makes more sense for users to check that the Netbox configuration is correct before doing any write operations
This commit is contained in:
parent
a3b8553cec
commit
9b236a6191
@ -41,6 +41,7 @@
|
|||||||
- @xen-orchestra/xapi minor
|
- @xen-orchestra/xapi minor
|
||||||
- xo-server minor
|
- xo-server minor
|
||||||
- xo-server-backup-reports minor
|
- xo-server-backup-reports minor
|
||||||
|
- xo-server-netbox patch
|
||||||
- xo-server-usage-report patch
|
- xo-server-usage-report patch
|
||||||
- xo-web minor
|
- xo-web minor
|
||||||
|
|
||||||
|
@ -103,6 +103,8 @@ class Netbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async test() {
|
async test() {
|
||||||
|
await this.#checkCustomFields()
|
||||||
|
|
||||||
const randomSuffix = Math.random().toString(36).slice(2, 11)
|
const randomSuffix = Math.random().toString(36).slice(2, 11)
|
||||||
const name = '[TMP] Xen Orchestra Netbox plugin test - ' + randomSuffix
|
const name = '[TMP] Xen Orchestra Netbox plugin test - ' + randomSuffix
|
||||||
await this.#request('/virtualization/cluster-types/', 'POST', {
|
await this.#request('/virtualization/cluster-types/', 'POST', {
|
||||||
@ -113,8 +115,6 @@ class Netbox {
|
|||||||
})
|
})
|
||||||
const nbClusterTypes = await this.#request(`/virtualization/cluster-types/?name=${encodeURIComponent(name)}`)
|
const nbClusterTypes = await this.#request(`/virtualization/cluster-types/?name=${encodeURIComponent(name)}`)
|
||||||
|
|
||||||
await this.#checkCustomFields()
|
|
||||||
|
|
||||||
if (nbClusterTypes.length !== 1) {
|
if (nbClusterTypes.length !== 1) {
|
||||||
throw new Error('Could not properly write and read Netbox')
|
throw new Error('Could not properly write and read Netbox')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user