@@ -24,6 +24,9 @@ const (
2424)
2525
2626var (
27+ ChannelRequiredOnlyResource = ChannelResourceDependencies +
28+ generateResourceFromRepresentationMap ("oci_mysql_channel" , "test_channel" , Required , Create , channelRepresentation )
29+
2730 channelSingularDataSourceRepresentation = map [string ]interface {}{
2831 "channel_id" : Representation {repType : Required , create : `${oci_mysql_channel.test_channel.id}` },
2932 }
4750 "defined_tags" : Representation {repType : Optional , create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
4851 "description" : Representation {repType : Optional , create : `description` , update : `description2` },
4952 "display_name" : Representation {repType : Optional , create : `displayName` , update : `displayName2` },
50- "freeform_tags" : Representation {repType : Optional , create : map [string ]string {"freeformTags " : "freeformTags " }, update : map [string ]string {"freeformTags2 " : "freeformTags2 " }},
53+ "freeform_tags" : Representation {repType : Optional , create : map [string ]string {"bar-key " : "value " }, update : map [string ]string {"Department " : "Accounting " }},
5154 "is_enabled" : Representation {repType : Optional , create : `true` , update : `false` },
5255 }
5356
8184 "channel_name" : Representation {repType : Optional , create : `channelname` , update : `channelname2` },
8285 }
8386
84- ChannelRequiredOnlyResource = ChannelResourceDependencies +
85- generateResourceFromRepresentationMap ("oci_mysql_channel" , "test_channel" , Required , Create , channelRepresentation )
86-
8787 ChannelWithOptionalsResource = ChannelResourceDependencies +
8888 generateResourceFromRepresentationMap ("oci_mysql_channel" , "test_channel" , Optional , Create , channelRepresentation )
8989
@@ -108,9 +108,7 @@ func TestMysqlChannelResource_basic(t *testing.T) {
108108 compartmentIdVariableStr := fmt .Sprintf ("variable \" compartment_id\" { default = \" %s\" }\n " , compartmentId )
109109
110110 resourceName := "oci_mysql_channel.test_channel"
111-
112111 datasourceName := "data.oci_mysql_channels.test_channels"
113-
114112 singularDatasourceName := "data.oci_mysql_channel.test_channel"
115113
116114 var resId , resId2 string
@@ -130,8 +128,8 @@ func TestMysqlChannelResource_basic(t *testing.T) {
130128 resource .TestCheckResourceAttr (resourceName , "source.0.hostname" , "hostname.my.company.com" ),
131129 resource .TestCheckResourceAttr (resourceName , "source.0.password" , "BEstrO0ng_#11" ),
132130 resource .TestCheckResourceAttr (resourceName , "source.0.source_type" , "MYSQL" ),
133- resource .TestCheckResourceAttr (resourceName , "source.0.username" , "username" ),
134131 resource .TestCheckResourceAttr (resourceName , "source.0.ssl_mode" , "REQUIRED" ),
132+ resource .TestCheckResourceAttr (resourceName , "source.0.username" , "username" ),
135133 resource .TestCheckResourceAttr (resourceName , "target.#" , "1" ),
136134 resource .TestCheckResourceAttrSet (resourceName , "target.0.db_system_id" ),
137135 resource .TestCheckResourceAttr (resourceName , "target.0.target_type" , "DBSYSTEM" ),
@@ -220,8 +218,7 @@ func TestMysqlChannelResource_basic(t *testing.T) {
220218 {
221219 Config : config +
222220 generateDataSourceFromRepresentationMap ("oci_mysql_channels" , "test_channels" , Optional , Update , channelDataSourceRepresentation ) +
223- compartmentIdVariableStr + ChannelResourceDependencies +
224- generateResourceFromRepresentationMap ("oci_mysql_channel" , "test_channel" , Optional , Update , channelRepresentation ),
221+ compartmentIdVariableStr + ChannelUpdateResource ,
225222 Check : resource .ComposeAggregateTestCheckFunc (
226223 resource .TestCheckResourceAttrSet (datasourceName , "channel_id" ),
227224 resource .TestCheckResourceAttr (datasourceName , "compartment_id" , compartmentId ),
@@ -236,29 +233,23 @@ func TestMysqlChannelResource_basic(t *testing.T) {
236233 {
237234 Config : config +
238235 generateDataSourceFromRepresentationMap ("oci_mysql_channel" , "test_channel" , Required , Create , channelSingularDataSourceRepresentation ) +
239- compartmentIdVariableStr + ChannelResourceConfig ,
236+ compartmentIdVariableStr + ChannelUpdateResource ,
240237 Check : resource .ComposeAggregateTestCheckFunc (
241238 resource .TestCheckResourceAttrSet (singularDatasourceName , "channel_id" ),
242239 ),
243240 },
244241 // remove singular datasource from previous step so that it doesn't conflict with import tests
245242 {
246- Config : config + compartmentIdVariableStr + ChannelResourceConfig ,
243+ Config : config + compartmentIdVariableStr + ChannelUpdateResource ,
247244 },
248245 // verify resource import
249246 {
250247 Config : config ,
251248 ImportState : true ,
252249 ImportStateVerify : true ,
253250 ImportStateVerifyIgnore : []string {
254- "compartment_id" ,
255- "defined_tags" ,
256- "description" ,
257- "display_name" ,
258- "freeform_tags" ,
259- "is_enabled" ,
260- "source" ,
261- "target" ,
251+ "lifecycle_details" ,
252+ "source.0.password" ,
262253 },
263254 ResourceName : resourceName ,
264255 },
0 commit comments