0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
terraform-provider-proxmox/fwprovider/test/resource_time_test.go
Pavel Boldyrev b4d4e4f9d4
fix(time): embed timezone data to fix set/get TZ on windows (#1436)
* fix(time): embed timezone data to fix set/get TZ on windows

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-10 21:07:40 -04:00

66 lines
1.6 KiB
Go

//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/.
*/
package test
import (
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccResourceTime(t *testing.T) {
t.Parallel()
te := InitEnvironment(t)
tests := []struct {
name string
steps []resource.TestStep
}{
{"change timezone", []resource.TestStep{
{
Config: te.RenderConfig(`resource "proxmox_virtual_environment_time" "node_time" {
node_name = "{{.NodeName}}"
time_zone = "Europe/Amsterdam"
}`),
Check: ResourceAttributes("proxmox_virtual_environment_time.node_time", map[string]string{
"time_zone": "Europe/Amsterdam",
}),
},
{
Config: te.RenderConfig(`resource "proxmox_virtual_environment_time" "node_time" {
node_name = "{{.NodeName}}"
time_zone = "UTC"
}`),
Check: ResourceAttributes("proxmox_virtual_environment_time.node_time", map[string]string{
"time_zone": "UTC",
}),
},
{
Config: te.RenderConfig(`resource "proxmox_virtual_environment_time" "node_time" {
node_name = "{{.NodeName}}"
time_zone = "UTC"
}`),
Check: ResourceAttributes("proxmox_virtual_environment_time.node_time", map[string]string{
"time_zone": "UTC",
}),
},
}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: te.AccProviders,
Steps: tt.steps,
})
})
}
}