/* * 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/. */ package tests import ( "context" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccResourceVM(t *testing.T) { t.Parallel() tests := []struct { name string step resource.TestStep }{ {"multiline description", resource.TestStep{ Config: ` resource "proxmox_virtual_environment_vm" "test_vm1" { node_name = "pve" started = false description = <<-EOT my description value EOT }`, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("proxmox_virtual_environment_vm.test_vm1", "description", "my\ndescription\nvalue"), ), }}, {"single line description", resource.TestStep{ Config: ` resource "proxmox_virtual_environment_vm" "test_vm2" { node_name = "pve" started = false description = "my description value" }`, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("proxmox_virtual_environment_vm.test_vm2", "description", "my description value"), ), }}, {"no description", resource.TestStep{ Config: ` resource "proxmox_virtual_environment_vm" "test_vm3" { node_name = "pve" started = false description = "" }`, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("proxmox_virtual_environment_vm.test_vm3", "description", ""), ), }}, } accProviders := testAccMuxProviders(context.Background(), t) for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: accProviders, Steps: []resource.TestStep{tt.step}, }) }) } } func TestAccResourceVMNetwork(t *testing.T) { tests := []struct { name string step resource.TestStep }{ {"network interfaces", resource.TestStep{ Config: ` resource "proxmox_virtual_environment_file" "cloud_config" { content_type = "snippets" datastore_id = "local" node_name = "pve" source_raw { data = <