0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00

chore(testacc): add missing acceptance build tags, improve vscode settings (#1723)

* split testacc and remove settings.json

Signed-off-by: rafsaf <rafal.safin@rafsaf.pl>

* further tags and contributing file update

Signed-off-by: rafsaf <rafal.safin@rafsaf.pl>

* revert testacc changes

Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl>

---------

Signed-off-by: rafsaf <rafal.safin@rafsaf.pl>
Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl>
Co-authored-by: rafsaf <rafal.safin@rafsaf.pl>
This commit is contained in:
Rafał Safin 2025-01-25 23:20:18 +01:00 committed by GitHub
parent 5e7e7994d5
commit 974a3c9069
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 155 additions and 140 deletions

3
.gitignore vendored
View File

@ -45,3 +45,6 @@ id_rsa.pub
# Binary
terraform-provider-proxmox*
# .vscode
.vscode/settings.json

133
.vscode/settings.example.json vendored Normal file
View File

@ -0,0 +1,133 @@
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": false,
"editor.guides.bracketPairsHorizontal": false,
"editor.guides.highlightActiveBracketPair": true,
"editor.rulers": [100],
"git.alwaysSignOff": true,
"cSpell.words": [
"aarch",
"ACPI",
"archlinux",
"armhf",
"bodyclose",
"burstable",
"capi",
"CDROM",
"cloudinit",
"CLRF",
"clusterfirewall",
"cmode",
"cpulimit",
"CPUNUMA",
"cpus",
"cputype",
"cpuunits",
"customdiff",
"datasource",
"datasources",
"deepcode",
"directsync",
"efidisk",
"efidisks",
"FSTRIM",
"fwprovider",
"gocritic",
"gosimple",
"hookscript",
"hostnodes",
"hostpci",
"Hotplugged",
"Hugepages",
"iface",
"importdisk",
"iothread",
"iothreads",
"ivshmem",
"keyctl",
"knownhosts",
"mbps",
"mdev",
"nameserver",
"nestif",
"nixos",
"nolint",
"NUMA",
"ostype",
"OVMF",
"prealloc",
"proxmoxtf",
"pvesm",
"qcow",
"ROMBAR",
"romfile",
"rootfs",
"seabios",
"signoff",
"skeema",
"SMBIOSSKU",
"SMBIOSUUID",
"stretchr",
"testacc",
"tflog",
"tfstate",
"tfvars",
"tpmstate",
"unmanaged",
"unthrottled",
"uring",
"usbdisk",
"vcpus",
"virtio",
"VLANID",
"vmbr",
"VMID",
"vztmpl",
"writeback",
"writethrough",
"wvista",
"XVGA"
],
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--config=${workspaceFolder}/.golangci.yml", "--fast"],
"go.lintOnSave": "workspace",
"go.testEnvFile": "${workspaceFolder}/testacc.env",
"material-icon-theme.folders.associations": {
".github/workflows": "robot",
"fwprovider": "middleware",
"proxmox": "api",
"proxmoxtf": "container",
"structure": "utils",
"access": "admin",
"firewall": "secure",
"nodes": "server",
"storage": "database",
"pools": "batch",
"ssh": "connection",
"version": "include",
"datasource": "database"
},
"psi-header.config": {
"forceToTop": true,
"blankLinesAfter": 1,
"license": "Apache-2.0"
},
"psi-header.changes-tracking": {
"include": ["go"],
"isActive": true,
"enforceHeader": true
},
"psi-header.templates": [
{
"language": "*",
"template": [
"This Source Code Form is subject to the terms of the Mozilla Public",
"License, v. 2.0. If a copy of the MPL was not distributed with this",
"file, You can obtain one at https://mozilla.org/MPL/2.0/."
]
}
],
"makefile.configureOnOpen": false,
"go.buildFlags": ["-tags=all"],
"gopls": { "build.buildFlags": ["-tags=all"] }
}

136
.vscode/settings.json vendored
View File

@ -1,136 +0,0 @@
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": false,
"editor.guides.bracketPairsHorizontal": false,
"editor.guides.highlightActiveBracketPair": true,
"editor.rulers": [
100
],
"git.alwaysSignOff": true,
"cSpell.words": [
"aarch",
"ACPI",
"archlinux",
"armhf",
"bodyclose",
"burstable",
"capi",
"CDROM",
"cloudinit",
"CLRF",
"clusterfirewall",
"cmode",
"cpulimit",
"CPUNUMA",
"cpus",
"cputype",
"cpuunits",
"customdiff",
"datasource",
"datasources",
"deepcode",
"directsync",
"efidisk",
"efidisks",
"FSTRIM",
"fwprovider",
"gocritic",
"gosimple",
"hookscript",
"hostnodes",
"hostpci",
"Hotplugged",
"Hugepages",
"iface",
"importdisk",
"iothread",
"iothreads",
"ivshmem",
"keyctl",
"knownhosts",
"mbps",
"mdev",
"nameserver",
"nestif",
"nixos",
"nolint",
"NUMA",
"ostype",
"OVMF",
"prealloc",
"proxmoxtf",
"pvesm",
"qcow",
"ROMBAR",
"romfile",
"rootfs",
"seabios",
"signoff",
"skeema",
"SMBIOSSKU",
"SMBIOSUUID",
"stretchr",
"testacc",
"tflog",
"tfstate",
"tfvars",
"tpmstate",
"unmanaged",
"unthrottled",
"uring",
"usbdisk",
"vcpus",
"virtio",
"VLANID",
"vmbr",
"VMID",
"vztmpl",
"writeback",
"writethrough",
"wvista",
"XVGA"
],
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--config=${workspaceFolder}/.golangci.yml",
"--fast"
],
"go.lintOnSave": "workspace",
"go.testEnvFile": "${workspaceFolder}/testacc.env",
"material-icon-theme.folders.associations": {
".github/workflows": "robot",
"fwprovider": "middleware",
"proxmox": "api",
"proxmoxtf": "container",
"structure": "utils",
"access": "admin",
"firewall": "secure",
"nodes": "server",
"storage": "database",
"pools": "batch",
"ssh": "connection",
"version": "include",
"datasource": "database",
},
"psi-header.config": {
"forceToTop": true,
"blankLinesAfter": 1,
"license": "Apache-2.0",
},
"psi-header.changes-tracking": {
"include": ["go"],
"isActive": true,
"enforceHeader": true,
},
"psi-header.templates": [
{
"language": "*",
"template": [
"This Source Code Form is subject to the terms of the Mozilla Public",
"License, v. 2.0. If a copy of the MPL was not distributed with this",
"file, You can obtain one at https://mozilla.org/MPL/2.0/.",
],
},
],
"makefile.configureOnOpen": false
}

View File

@ -39,6 +39,10 @@ ability to merge PRs and respond to issues.
The binaries will be placed in the `dist` directory.
## IDE support
If you are using VS Code, feel free to copy `settings.json` from `.vscode/settings.example.json`.
## Testing
The project has a handful of test cases which must pass for a contribution to be
@ -61,9 +65,11 @@ PROXMOX_VE_API_TOKEN="root@pam!<token name>=<token value>"
PROXMOX_VE_ENDPOINT="https://<pve instance>:8006/"
PROXMOX_VE_SSH_AGENT="true"
PROXMOX_VE_SSH_USERNAME="root"
# optionally, youcan override the default node name and ssh address
# optionally, you can override the default node name and ssh address and other things
#PROXMOX_VE_ACC_NODE_NAME="pve1"
#PROXMOX_VE_ACC_NODE_SSH_ADDRESS="10.0.0.11"
#PROXMOX_VE_ACC_NODE_SSH_PORT="22"
#PROXMOX_VE_ACC_IFACE_NAME="enp1s0"
```
Then use `make testacc` to run the acceptance tests.

View File

@ -10,6 +10,7 @@ package network_test
import (
"fmt"
"os"
"strconv"
"testing"
@ -26,7 +27,11 @@ const (
func TestAccResourceLinuxVLAN(t *testing.T) {
te := test.InitEnvironment(t)
iface := "ens18"
iface := os.Getenv("PROXMOX_VE_ACC_IFACE_NAME")
if iface == "" {
iface = "ens18"
}
vlan1 := gofakeit.Number(10, 4094)
customName := fmt.Sprintf("iface_%s", gofakeit.Word())
vlan2 := gofakeit.Number(10, 4094)

View File

@ -1,3 +1,5 @@
//go:build acceptance || all
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this

View File

@ -1,11 +1,11 @@
//go:build acceptance || all
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
//go:build acceptance || all
package test
import (

View File

@ -1,3 +1,5 @@
//go:build acceptance || all
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this