-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix): Fixed application segment pra and inspection (#375)
* (fix): Fixed application segment pra and inspection * (fix): Upgrade to zscaler-sdk-go v2.1.3 * (Fix): Fixed zpa custom pagination search mechanism via SDK v2.1.3
- Loading branch information
Showing
10 changed files
with
154 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ on: | |
|
||
schedule: | ||
- cron: '0 13 * * 1-5' # UTC | ||
workflow_dispatch: | ||
|
||
jobs: | ||
zpa-qa-tenant01: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,60 @@ | ||
package zpa | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
var machineGroupNames = []string{ | ||
"BD-MGR01", "BD-MGR02", "BD MGR 03", "BD MGR 04", "BD MGR 05", | ||
"BD MGR06", "BD MGR 07", "BD M GR 08", "BD M GR 09", | ||
} | ||
|
||
func TestAccDataSourceMachineGroup_Basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckDataSourceMachineGroup_basic, | ||
Config: testAccCheckDataSourceMachineGroup_basic(), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccDataSourceMachineGroupCheck("data.zpa_machine_group.bd_mgr01"), | ||
testAccDataSourceMachineGroupCheck("data.zpa_machine_group.bd_mgr02"), | ||
generateMachineGroupChecks()..., | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceMachineGroupCheck(name string) resource.TestCheckFunc { | ||
return resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(name, "id"), | ||
resource.TestCheckResourceAttrSet(name, "name"), | ||
) | ||
func generateMachineGroupChecks() []resource.TestCheckFunc { | ||
var checks []resource.TestCheckFunc | ||
for _, name := range machineGroupNames { | ||
resourceName := createValidResourceName(name) | ||
checkName := fmt.Sprintf("data.zpa_machine_group.%s", resourceName) | ||
checks = append(checks, resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(checkName, "id"), | ||
resource.TestCheckResourceAttrSet(checkName, "name"), | ||
)) | ||
} | ||
return checks | ||
} | ||
|
||
var testAccCheckDataSourceMachineGroup_basic = ` | ||
data "zpa_machine_group" "bd_mgr01" { | ||
name = "BD-MGR01" | ||
func testAccCheckDataSourceMachineGroup_basic() string { | ||
var configs string | ||
for _, name := range machineGroupNames { | ||
resourceName := createValidResourceName(name) | ||
configs += fmt.Sprintf(` | ||
data "zpa_machine_group" "%s" { | ||
name = "%s" | ||
} | ||
`, resourceName, name) | ||
} | ||
return configs | ||
} | ||
|
||
data "zpa_machine_group" "bd_mgr02" { | ||
name = "BD-MGR02" | ||
// createValidResourceName converts the given name to a valid Terraform resource name | ||
func createValidResourceName(name string) string { | ||
return strings.ReplaceAll(name, " ", "_") | ||
} | ||
` |
Oops, something went wrong.