88 "testing"
99
1010 "github.com/hashicorp/terraform-plugin-sdk/helper/resource"
11- "github.com/hashicorp/terraform-plugin-sdk/terraform"
1211
1312 "github.com/terraform-providers/terraform-provider-oci/httpreplay"
1413)
1817 "compartment_id" : Representation {repType : Required , create : `${var.compartment_id}` },
1918 "group_by" : Representation {repType : Required , create : []string {`version` }},
2019 "has_plugins" : Representation {repType : Required , create : `true` },
20+ "install_type" : Representation {repType : Required , create : `AGENT` },
2121 }
2222
2323 ManagementAgentCountResourceConfig = ""
@@ -28,7 +28,6 @@ func TestManagementAgentManagementAgentCountResource_basic(t *testing.T) {
2828 httpreplay .SetScenario ("TestManagementAgentManagementAgentCountResource_basic" )
2929 defer httpreplay .SaveScenario ()
3030
31- provider := testAccProvider
3231 config := testProviderConfig ()
3332
3433 compartmentId := getEnvSettingWithBlankDefault ("compartment_ocid" )
@@ -38,24 +37,19 @@ func TestManagementAgentManagementAgentCountResource_basic(t *testing.T) {
3837
3938 saveConfigContent ("" , "" , "" , t )
4039
41- resource .Test (t , resource.TestCase {
42- PreCheck : func () { testAccPreCheck (t ) },
43- Providers : map [string ]terraform.ResourceProvider {
44- "oci" : provider ,
45- },
46- Steps : []resource.TestStep {
47- // verify singular datasource
48- {
49- Config : config +
50- generateDataSourceFromRepresentationMap ("oci_management_agent_management_agent_count" , "test_management_agent_count" , Required , Create , managementAgentCountSingularDataSourceRepresentation ) +
51- compartmentIdVariableStr + ManagementAgentCountResourceConfig ,
52- Check : ComposeAggregateTestCheckFuncWrapper (
53- resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
54- resource .TestCheckResourceAttr (singularDatasourceName , "has_plugins" , "true" ),
55-
56- resource .TestCheckResourceAttrSet (singularDatasourceName , "items.#" ),
57- ),
58- },
40+ ResourceTest (t , nil , []resource.TestStep {
41+ // verify singular datasource
42+ {
43+ Config : config +
44+ generateDataSourceFromRepresentationMap ("oci_management_agent_management_agent_count" , "test_management_agent_count" , Required , Create , managementAgentCountSingularDataSourceRepresentation ) +
45+ compartmentIdVariableStr + ManagementAgentCountResourceConfig ,
46+ Check : ComposeAggregateTestCheckFuncWrapper (
47+ resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
48+ resource .TestCheckResourceAttr (singularDatasourceName , "has_plugins" , "true" ),
49+ resource .TestCheckResourceAttr (singularDatasourceName , "install_type" , "AGENT" ),
50+
51+ resource .TestCheckResourceAttrSet (singularDatasourceName , "items.#" ),
52+ ),
5953 },
6054 })
6155}
0 commit comments