Skip to content

Commit

Permalink
check mtls test
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-omerma committed Dec 8, 2024
1 parent df37131 commit bfcdcc2
Showing 1 changed file with 59 additions and 23 deletions.
82 changes: 59 additions & 23 deletions internal/resources/tests/add-mtls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) {
"source_identifier.1.values.#": "1",
"source_identifier.0.values.#": "1",
"source_identifier.0.values_ids.#": "1",
"proxy_setting.#": "6", //was 3
"proxy_setting.#": "3", //was 3
"proxy_setting.0.%": "3",
"proxy_setting.1.%": "3",
"proxy_setting.2.%": "3",
Expand All @@ -95,9 +95,15 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) {
"tags.0.key": "tagkey1",
"tags.0.value": "tagvalue1",

"proxy_setting.3.%": "3",
"proxy_setting.4.%": "3",
"proxy_setting.5.%": "3",
//"proxy_setting.3.%": "3",
//"proxy_setting.4.%": "3",
//"proxy_setting.5.%": "3",

"mtls.#": "1",
"mtls.0.filename": "cert.pem",
"mtls.0.data": "cert data",
"mtls.0.type": "client",
"mtls.0.enable": "true",
}),
resource.TestCheckResourceAttrSet(assetResourceName, "id"),
resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"),
Expand All @@ -111,6 +117,9 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) {
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path2", assetNameAttribute)),
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path3", assetNameAttribute)),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"),
)...,
),
ExpectNonEmptyPlan: true,
Expand Down Expand Up @@ -177,7 +186,7 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) {
"source_identifier.1.values.#": "1",
"source_identifier.0.values.#": "1",
"source_identifier.0.values_ids.#": "1",
"proxy_setting.#": "6", //was 3
"proxy_setting.#": "3", //was 3
"proxy_setting.0.%": "3",
"proxy_setting.1.%": "3",
"proxy_setting.2.%": "3",
Expand All @@ -197,9 +206,15 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) {
"tags.1.key": "tagkey2",
"tags.1.value": "tagvalue2",

"proxy_setting.3.%": "3",
"proxy_setting.4.%": "3",
"proxy_setting.5.%": "3",
//"proxy_setting.3.%": "3",
//"proxy_setting.4.%": "3",
//"proxy_setting.5.%": "3",

"mtls.#": "1",
"mtls.0.filename": "cert.pem",
"mtls.0.data": "cert data",
"mtls.0.type": "client",
"mtls.0.enable": "true",
}),
resource.TestCheckResourceAttrSet(assetResourceName, "id"),
resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"),
Expand All @@ -209,13 +224,17 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) {
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.0.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.1.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.2.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"),
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path1", assetNameAttribute)),
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path2", assetNameAttribute)),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.1.id"),

resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"),
)...,
),
ExpectNonEmptyPlan: true,
Expand Down Expand Up @@ -278,12 +297,22 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) {
"tags.2.key": "tagkey3",
"tags.2.value": "tagvalue3",

"proxy_setting.3.%": "3",
"proxy_setting.4.%": "3",
"proxy_setting.5.%": "3",
"proxy_setting.6.%": "3",
"proxy_setting.7.%": "3",
"proxy_setting.8.%": "3",
//"proxy_setting.3.%": "3",
//"proxy_setting.4.%": "3",
//"proxy_setting.5.%": "3",
//"proxy_setting.6.%": "3",
//"proxy_setting.7.%": "3",
//"proxy_setting.8.%": "3",

"mtls.#": "2",
"mtls.0.filename": "newfile.pem",
"mtls.0.data": "new cert data",
"mtls.0.type": "server",
"mtls.0.enable": "true",
"mtls.1.filename": "newfile2.pem",
"mtls.1.data": "new cert data2",
"mtls.1.type": "client",
"mtls.1.enable": "false",
}),
resource.TestCheckResourceAttrSet(assetResourceName, "id"),
resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"),
Expand All @@ -293,17 +322,24 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) {
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.0.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.1.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.2.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.6.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.7.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.8.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.6.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.7.id"),
//resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.8.id"),
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path3", assetNameAttribute)),
resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path4", assetNameAttribute)),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.1.id"),
resource.TestCheckResourceAttrSet(assetResourceName, "tags.2.id"),

resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.filename_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.data_id"),
resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.enable_id"),
)...,
),
ExpectNonEmptyPlan: true,
Expand Down

0 comments on commit bfcdcc2

Please sign in to comment.