@@ -23,10 +23,8 @@ type ResourceCoreSecurityListTestSuite struct {
2323 Providers map [string ]terraform.ResourceProvider
2424 TimeCreated baremetal.Time
2525 Config string
26+ SLConfig string
2627 ResourceName string
27- Res * baremetal.SecurityList
28- DeletingRes * baremetal.SecurityList
29- DeletedRes * baremetal.SecurityList
3028}
3129
3230func extraWait (ew crud.ExtraWaitPostCreateDelete ) {
@@ -71,7 +69,8 @@ resource "baremetal_core_route_table" "RouteForComplete" {
7169 network_entity_id = "${baremetal_core_internet_gateway.CompleteIG.id}"
7270 }
7371}
74-
72+ `
73+ s .SLConfig = `
7574resource "baremetal_core_security_list" "t" {
7675 compartment_id = "${var.compartment_id}"
7776 display_name = "Public"
@@ -107,9 +106,11 @@ func (s *ResourceCoreSecurityListTestSuite) TestCreateResourceCoreSecurityList()
107106 {
108107 ImportState : true ,
109108 ImportStateVerify : true ,
110- Config : s .Config ,
109+ Config : s .Config + s . SLConfig ,
111110 Check : resource .ComposeTestCheckFunc (
112111 resource .TestCheckResourceAttr (s .ResourceName , "display_name" , "Public" ),
112+ resource .TestCheckResourceAttr (s .ResourceName , "egress_security_rules.#" , "1" ),
113+ resource .TestCheckResourceAttr (s .ResourceName , "ingress_security_rules.#" , "2" ),
113114 resource .TestCheckResourceAttr (s .ResourceName , "egress_security_rules.0.stateless" , "false" ),
114115 resource .TestCheckResourceAttr (s .ResourceName , "ingress_security_rules.0.tcp_options.0.max" , "80" ),
115116 ),
@@ -118,6 +119,36 @@ func (s *ResourceCoreSecurityListTestSuite) TestCreateResourceCoreSecurityList()
118119 })
119120}
120121
122+ func (s * ResourceCoreSecurityListTestSuite ) TestCreateResourceCoreSecurityListRemoveRules () {
123+
124+ resource .UnitTest (s .T (), resource.TestCase {
125+ Providers : s .Providers ,
126+ Steps : []resource.TestStep {
127+ {
128+ ImportState : true ,
129+ ImportStateVerify : true ,
130+ Config : s .Config + s .SLConfig ,
131+ },
132+ {
133+ Config : s .Config + `
134+ resource "baremetal_core_security_list" "t" {
135+ compartment_id = "${var.compartment_id}"
136+ display_name = "Public"
137+ vcn_id = "${baremetal_core_virtual_network.t.id}"
138+ egress_security_rules = []
139+ ingress_security_rules = []
140+ }
141+ ` ,
142+ Check : resource .ComposeTestCheckFunc (
143+ resource .TestCheckResourceAttr (s .ResourceName , "display_name" , "Public" ),
144+ resource .TestCheckResourceAttr (s .ResourceName , "egress_security_rules.#" , "0" ),
145+ resource .TestCheckResourceAttr (s .ResourceName , "ingress_security_rules.#" , "0" ),
146+ ),
147+ },
148+ },
149+ })
150+ }
151+
121152
122153func (s * ResourceCoreSecurityListTestSuite ) TestDeleteSecurityList () {
123154
0 commit comments