Skip to content

Commit

Permalink
gh: Refactored Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Feb 9, 2024
1 parent de9acce commit 4d54e69
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 4 deletions.
70 changes: 69 additions & 1 deletion .github/workflows/zia-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ jobs:
environment:
- ZIA_ZSCLOUD
- ZIA_ZS0
# - ZIA_ZS1
- ZIA_ZS2
- ZIA_ZS3
environment: ${{ matrix.environment }}
Expand Down Expand Up @@ -156,3 +155,72 @@ jobs:
ZIA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZIA_ACC_TEST_FORCE_SWEEPERS }}
needs:
- zia-zsbeta-tests

zia-zscalerone-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goVersion: ["1.20"]
environment:
- ZIA_ZS1
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goVersion }}

- name: Set Go env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Setup Go Tools
run: make tools

- name: Download Go Dependencies
run: |
go mod tidy && go mod vendor
- name: Setup Go Tools
run: make tools

- name: Check Formatting
run: make fmtcheck

- name: Vet Code
run: make vet

- name: Lint Code
run: make lint

- name: Check Build
run: make build

- name: Run tests with retry on Ubuntu
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 60 # Adjust as needed
command: |
make sweep
make test:integration:zscalerone
make sweep
env:
ZIA_USERNAME: ${{ secrets.ZIA_USERNAME }}
ZIA_PASSWORD: ${{ secrets.ZIA_PASSWORD }}
ZIA_API_KEY: ${{ secrets.ZIA_API_KEY }}
ZIA_CLOUD: ${{ secrets.ZIA_CLOUD }}
ZIA_SANDBOX_TOKEN: ${{ secrets.ZIA_SANDBOX_TOKEN }}
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }}
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }}
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }}
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }}
TF_ACC: ${{ secrets.TF_ACC }}
ZIA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZIA_ACC_TEST_FORCE_SWEEPERS }}
needs:
- zia-zsbeta-tests
69 changes: 69 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,75 @@ test:
testacc:
TF_ACC=1 go test $(TEST) $(TESTARGS) $(TEST_FILTER) -timeout 120m

# Default set of integration tests to run for ZscalerOne
DEFAULT_INTEGRATION_TESTS?=\
TestAccDataSourceActivationStatus_Basic \
TestAccDataSourceAdminRoles_Basic \
TestAccDataSourceAdminUsers_Basic \
TestAccDataSourceFWApplicationServicesGroupLite_Basic \
TestAccDataSourceFWApplicationServicesLite_Basic \
TestAccDataSourceAuthSettingsUrls_Basic \
TestAccDataSourceCBIProfile_Basic \
TestAccDataSourceDeviceGroups_Basic \
TestAccDataSourceDLPDictionaries_Basic \
TestAccDataSourceDLPEngines_Basic \
TestAccDataSourceDLPICAPServers_Basic \
TestAccDataSourceDLPIncidentReceiverServers_Basic \
TestAccDataSourceDLPNotificationTemplates_Basic \
TestAccDataSourceDlpWebRules_Basic \
TestAccDataSourceFirewallFilteringRule_Basic \
TestAccDataSourceFWIPDestinationGroups_Basic \
TestAccDataSourceFWIPSourceGroups_Basic \
TestAccDataSourceFWNetworkApplicationGroups_Basic \
TestAccDataSourceFWNetworkServiceGroups_Basic \
TestAccResourceFWNetworkServicesBasic \
TestAccDataSourceFWTimeWindow_Basic \
TestAccDataSourceLocationGroup_Basic \
TestAccDataSourceLocationLite_Basic \
TestAccDataSourceLocationManagement_Basic \
TestAccDataSourceRuleLabels_Basic \
TestResourceSandboxSettings_basic \
TestAccDataSourceTrafficGreInternalIPRangeList_Basic \
TestAccDataSourceTrafficForwardingStaticIP_Basic \
TestAccDataSourceTrafficForwardingVPNCredentials_Basic \
TestAccDataSourceURLCategories_Basic \
TestAccDataSourceURLFilteringRules_Basic \
TestAccDataSourceDepartmentManagement_Basic \
TestAccDataSourceGroupManagement_Basic \
TestAccDataSourceUserManagement_Basic \
TestAccResourceAdminUsersBasic \
TestAccResourceAuthSettingsUrls_basic \
TestAccResourceDLPDictionariesBasic \
TestAccResourceDLPEnginesBasic \
TestAccResourceDLPNotificationTemplatesBasic \
TestAccResourceDlpWebRules_Basic \
TestAccResourceFirewallFilteringRuleBasic \
TestAccResourceFWIPDestinationGroupsBasic \
TestAccResourceFWIPSourceGroupsBasic \
TestAccResourceFWNetworkApplicationGroupsBasic \
TestAccResourceFWNetworkServiceGroupsBasic \
TestAccResourceFWNetworkServicesBasic \
TestAccResourceLocationManagementBasic \
TestAccResourceRuleLabelsBasic \
TestResourceSandboxSettings_basic \
TestAccResourceSecurityPolicySettings_basic \
TestAccResourceTrafficForwardingStaticIPBasic \
TestAccResourceTrafficForwardingVPNCredentialsBasic \
TestAccResourceURLCategoriesBasic \
TestAccResourceURLFilteringRulesBasic \
TestAccResourceUserManagementBasic

ifeq ($(strip $(INTEGRATION_TESTS)),)
INTEGRATION_TESTS = $(DEFAULT_INTEGRATION_TESTS)
endif

space := $(subst ,, )
integration_tests := $(subst $(space),\|,$(INTEGRATION_TESTS))

# Target to run integration tests for ZscalerOne
test\:integration\:zscalerone:
@echo "Running integration tests for ZscalerOne..."
@TF_ACC=1 go test -v -cover ./zia -timeout 120m -run ^$(integration_tests)$$

build13: GOOS=$(shell go env GOOS)
build13: GOARCH=$(shell go env GOARCH)
Expand Down
2 changes: 0 additions & 2 deletions zia/data_source_zia_sandbox_report_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package zia

/*
import (
"fmt"
"testing"
Expand Down Expand Up @@ -44,4 +43,3 @@ data "zia_sandbox_report" "summary" {
}
`, md5Hash, md5Hash)
}
*/
2 changes: 1 addition & 1 deletion zia/resource_zia_firewall_filtering_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ resource "%s" "%s" {
description = "%s"
action = "%s"
state = "%s"
order = 1
order = 3
enable_full_logging = "%s"
device_trust_levels = [ "UNKNOWN_DEVICETRUSTLEVEL", "LOW_TRUST", "MEDIUM_TRUST", "HIGH_TRUST" ]
nw_services {
Expand Down

0 comments on commit 4d54e69

Please sign in to comment.