Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorGFM committed Sep 26, 2023
1 parent 7b72ed1 commit 00eac9e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cyral/data_source_cyral_system_info_test.go
Original file line number Diff line number Diff line change
@@ -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,
}
}

0 comments on commit 00eac9e

Please sign in to comment.