From 00eac9e224f0030dd9fb25476cd7e6ca41eaa6c1 Mon Sep 17 00:00:00 2001 From: Victor Moraes Date: Tue, 26 Sep 2023 17:26:29 -0300 Subject: [PATCH] Add tests --- cyral/data_source_cyral_system_info_test.go | 49 +++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 cyral/data_source_cyral_system_info_test.go diff --git a/cyral/data_source_cyral_system_info_test.go b/cyral/data_source_cyral_system_info_test.go new file mode 100644 index 00000000..1b6502bf --- /dev/null +++ b/cyral/data_source_cyral_system_info_test.go @@ -0,0 +1,49 @@ +package cyral + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +const ( + systemInfoDataSourceFullNameFmt = "data.cyral_system_info.%s" +) + +func TestAccSystemInfoDataSource(t *testing.T) { + dataSourceName := "system_info" + testSteps := []resource.TestStep{ + accTestStepSystemInfoDataSource_ListAllSystemInfo(dataSourceName), + } + resource.ParallelTest(t, resource.TestCase{ + ProviderFactories: providerFactories, + Steps: testSteps, + }) +} + +func accTestStepSystemInfoDataSource_ListAllSystemInfo(dataSourceName string) resource.TestStep { + dataSourceFullName := fmt.Sprintf(systemInfoDataSourceFullNameFmt, dataSourceName) + config := fmt.Sprintf(` + data "cyral_system_info" "%s" { + } + `, dataSourceName) + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + dataSourceFullName, + IDKey, + ), + resource.TestCheckResourceAttrSet( + dataSourceFullName, + ControlPlaneVersionKey, + ), + resource.TestCheckResourceAttrSet( + dataSourceFullName, + SidecarLatestVersionKey, + ), + ) + return resource.TestStep{ + Config: config, + Check: check, + } +}