Skip to content

Commit

Permalink
US56815: Add IaC test case for CI CD purpose
Browse files Browse the repository at this point in the history
Split the dev test cases, upload the log as artifact
  • Loading branch information
mahesh-hpe committed Dec 19, 2023
1 parent 71041d6 commit 1f65835
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/dev-acc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
test_case:
description: 'Enter testcase (regex is acceptable)'
required: false
default: ''
type: string

# release:
# types: [published]
env:
Expand All @@ -24,6 +24,7 @@ env:
HPEGL_VMAAS_LOCATION: ${{ secrets.DEV_HPEGL_VMAAS_LOCATION }}
HPEGL_VMAAS_SPACE_NAME: ${{ secrets.DEV_HPEGL_VMAAS_SPACE_NAME}}
TF_ACC: ${{ secrets.TF_ACC }}
LOG_FILE: "Logs.txt"
jobs:
acc:
runs-on: ubuntu-20.04
Expand All @@ -49,4 +50,13 @@ jobs:

- name: Run Acceptance test
run: |
export TF_ACC_TEST_PATH="$(pwd)/acc-dev-testcases" && make acceptance
export TF_ACC_TEST_PATH="$(pwd)/acc-dev-testcases" && make acceptance case=${{ github.event.inputs.test_case }} >> $LOG_FILE
- name: Push the report to github artifacts
uses: actions/upload-artifact@v3
with:
name: "Terraform Test report ${{ github.event.inputs.test_case }}"
path: $LOG_FILE

- name: Clean up test report
run: rm $LOG_FILE
52 changes: 52 additions & 0 deletions .github/workflows/gw1.0-cicd-acc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Dev Acceptance Tests for CI CD

on:
# Runs every 2 days once at 3AM
# schedule:
# - cron: '0 21 */2 * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
# release:
# types: [published]
env:
HPEGL_IAM_SERVICE_URL: ${{ secrets.DEV_HPEGL_IAM_SERVICE_URL }}
HPEGL_TENANT_ID: ${{ secrets.DEV_HPEGL_TENANT_ID }}
HPEGL_USER_SECRET: ${{ secrets.DEV_HPEGL_USER_SECRET }}
HPEGL_USER_ID: ${{ secrets.DEV_HPEGL_USER_ID }}
HPEGL_VMAAS_API_URL: ${{ secrets.DEV_HPEGL_VMAAS_API_URL }}
HPEGL_VMAAS_LOCATION: ${{ secrets.DEV_HPEGL_VMAAS_LOCATION }}
HPEGL_VMAAS_SPACE_NAME: ${{ secrets.DEV_HPEGL_VMAAS_SPACE_NAME}}
TF_ACC: ${{ secrets.TF_ACC }}
jobs:
acc:
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.17' ]
name: Dev Acceptance Tests
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Install dependencies
run: |
sudo apt-get install -y wget jq
wget https://releases.hashicorp.com/terraform/1.0.0/terraform_1.0.0_linux_amd64.zip
sudo unzip -fo terraform_1.0.0_linux_amd64.zip -d /usr/local/bin
- name: Install necessary tools
run: make tools

- name: Run Acceptance test
run: |
export TF_ACC_TEST_PATH="$(pwd)/acc-dev-testcases" && make acceptance

0 comments on commit 1f65835

Please sign in to comment.