From 038fb8b40554f4a703bae07538fecf0fec2a32fc Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 11:02:39 -0600 Subject: [PATCH 01/22] Acceptance test --- .github/workflows/power-acceptance-test.yml | 106 ++++++++++++++++++ .../power/data_source_ibm_pi_images.go | 2 +- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/power-acceptance-test.yml diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml new file mode 100644 index 00000000000..36d8f4d980c --- /dev/null +++ b/.github/workflows/power-acceptance-test.yml @@ -0,0 +1,106 @@ +name: Run Acceptance Tests on Pull Request + +on: + pull_request: + paths: + - 'ibm/service/power/*.go' # Trigger only when test files within power are changed + types: [opened, synchronize, reopened] + +jobs: + acceptance-test: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout code + - name: Checkout code + uses: actions/checkout@v3 + + # Step 2: Set up Go environment + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.22' + # Step 3: Cache Go modules + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod', '**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + # Step 4: Install dependencies + - name: Install dependencies + run: | + go mod tidy + go mod download + + # Step 5: Install go-junit-report (before Step 7) + - name: Install go-junit-report + run: | + go install github.com/jstemmer/go-junit-report@latest + + # Step 6 : Find modified files, set environment variables, and run tests + - name: Find modified files and run acceptance tests + run: | + # Get the list of modified Go files in the PR under the service/power directory + modified_go_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} -- 'service/power/*.go') + + # Initialize an empty list for test files + modified_test_files="" + + # Loop through modified Go files to identify corresponding test files + for file in $modified_go_files; do + # Skip constants.go since it has no corresponding test file + if [[ "$file" == "ibm/service/power/ibm_pi_constants.go" ]]; then + echo "Skipping ibm_pi_constants.go as it has no test file." + continue + fi + + # Get the test file corresponding to the modified Go file by replacing .go with _test.go + test_file="${file%.go}_test.go" + + # If the test file exists, add it to the list of test files to run + if [ -f "$test_file" ]; then + modified_test_files+=" $test_file" + fi + done + + # If there are modified test files, run the tests + if [ -n "$modified_test_files" ]; then + echo "Modified test files: $modified_test_files" + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files + else + echo "No modified test files detected." + fi + env: + TF_ACC: ${{ secrets.TF_ACC }} + TF_CLI_ARGS_plan: ${{ secrets.TF_CLI_ARGS_plan }} + TF_CLI_ARGS_apply: ${{ secrets.TF_CLI_ARGS_apply }} + IC_API_KEY: ${{ secrets.IC_API_KEY }} + + # Step 7: Upload Test Results as JUnit Report (Optional Improvement) + - name: Upload test results + if: always() + run: | + # Create a directory for the test results + mkdir -p test-results + + # Run the tests and output in JUnit format + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log + + # Convert the output into JUnit XML format + go-junit-report < test-results/test-report.log > test-results/test-report.xml + + # Make sure the test results can be uploaded + continue-on-error: true # Allow workflow to continue even if tests fail + + # Step 8: Upload Test Results (JUnit) + - name: Upload JUnit test results as artifact + if: always() + uses: actions/upload-artifact@v3 + with: + name: acceptance-test-results + path: test-results/test-report.xml diff --git a/ibm/service/power/data_source_ibm_pi_images.go b/ibm/service/power/data_source_ibm_pi_images.go index 436837b1aad..941a02fb06a 100644 --- a/ibm/service/power/data_source_ibm_pi_images.go +++ b/ibm/service/power/data_source_ibm_pi_images.go @@ -135,7 +135,7 @@ func flattenStockImages(list []*models.ImageReference, meta interface{}) []map[s tags, err := flex.GetTagsUsingCRN(meta, string(i.Crn)) if err != nil { log.Printf( - "Error on get of image (%s) user_tags: %s", *i.ImageID, err) + "Error on get of image (%s) user_tags: %s", *i.ImageID, err) } l[Attr_UserTags] = tags } From c4eae47d402c682a8343579f698356979cd828b8 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 11:11:42 -0600 Subject: [PATCH 02/22] Acceptance test: update directory --- .github/workflows/power-acceptance-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 36d8f4d980c..8a173a68d95 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -46,7 +46,7 @@ jobs: - name: Find modified files and run acceptance tests run: | # Get the list of modified Go files in the PR under the service/power directory - modified_go_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} -- 'service/power/*.go') + modified_go_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} -- 'ibm/service/power/*.go') # Initialize an empty list for test files modified_test_files="" From df88a55b431f91933691ed59203d902be4a983b7 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 11:21:28 -0600 Subject: [PATCH 03/22] Acceptance test: fetch origin --- .github/workflows/power-acceptance-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 8a173a68d95..29c160fd0bc 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -45,9 +45,12 @@ jobs: # Step 6 : Find modified files, set environment variables, and run tests - name: Find modified files and run acceptance tests run: | - # Get the list of modified Go files in the PR under the service/power directory + # Get the list of modified Go files in the PR under the ibm/service/power directory + git fetch origin modified_go_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} -- 'ibm/service/power/*.go') + echo "Modified files: $modified_go_files" + # Initialize an empty list for test files modified_test_files="" From 9badfe5b917ed0faba2d319df9cbab7d70198f2e Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 11:48:22 -0600 Subject: [PATCH 04/22] Acceptance test: update env vars --- .github/workflows/power-acceptance-test.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 29c160fd0bc..c77b63781fc 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -82,7 +82,23 @@ jobs: TF_ACC: ${{ secrets.TF_ACC }} TF_CLI_ARGS_plan: ${{ secrets.TF_CLI_ARGS_plan }} TF_CLI_ARGS_apply: ${{ secrets.TF_CLI_ARGS_apply }} - IC_API_KEY: ${{ secrets.IC_API_KEY }} + IAAS_CLASSIC_API_KEY: ${{ secrets.IC_API_KEY }} + TF_LOG: ${{vars.TF_LOG}} + # Endpoints + IBMCLOUD_PI_API_ENDPOINT: ${{ vars.IBMCLOUD_PI_API_ENDPOINT }} + IBMCLOUD_IAM_API_ENDPOINT: ${{ vars.IBMCLOUD_IAM_API_ENDPOINT }} + IBMCLOUD_RESOURCE_CATALOG_API_ENDPOINT: ${{ vars.IBMCLOUD_RESOURCE_CATALOG_API_ENDPOINT }} + IBMCLOUD_RESOURCE_MANAGEMENT_API_ENDPOINT: ${{ vars.IBMCLOUD_RESOURCE_MANAGEMENT_API_ENDPOINT }} + IBMCLOUD_RESOURCE_CONTROLLER_API_ENDPOINT: ${{ vars.IBMCLOUD_RESOURCE_CONTROLLER_API_ENDPOINT }} + IBMCLOUD_GS_API_ENDPOINT: ${{ vars.IBMCLOUD_GS_API_ENDPOINT }} + IBMCLOUD_GT_API_ENDPOINT: ${{ vars.IBMCLOUD_GT_API_ENDPOINT }} + # Power + PI_CLOUDINSTANCE_ID: ${{ vars.PI_CLOUDINSTANCE_ID }} + IBMCLOUD_REGION: ${{ vars.IBMCLOUD_REGION }} + IBMCLOUD_ZONE: ${{ vars.IBMCLOUD_ZONE }} + + + # Step 7: Upload Test Results as JUnit Report (Optional Improvement) - name: Upload test results From 5963c36c4348c1762d2a250624c32e0ea281d7c1 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 12:05:14 -0600 Subject: [PATCH 05/22] Acceptance test: fix env vars --- .github/workflows/power-acceptance-test.yml | 29 ++++++--------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index c77b63781fc..14509759d60 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -45,6 +45,8 @@ jobs: # Step 6 : Find modified files, set environment variables, and run tests - name: Find modified files and run acceptance tests run: | + # Create report file + mkdir -p test-results # Get the list of modified Go files in the PR under the ibm/service/power directory git fetch origin modified_go_files=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} -- 'ibm/service/power/*.go') @@ -74,7 +76,9 @@ jobs: # If there are modified test files, run the tests if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log + + go-junit-report < test-results/test-report.log > test-results/test-report.xml else echo "No modified test files detected." fi @@ -82,7 +86,8 @@ jobs: TF_ACC: ${{ secrets.TF_ACC }} TF_CLI_ARGS_plan: ${{ secrets.TF_CLI_ARGS_plan }} TF_CLI_ARGS_apply: ${{ secrets.TF_CLI_ARGS_apply }} - IAAS_CLASSIC_API_KEY: ${{ secrets.IC_API_KEY }} + IC_API_KEY: ${{ secrets.IC_API_KEY }} + IAAS_CLASSIC_API_KEY: ${{ secrets.IAAS_CLASSIC_API_KEY }} TF_LOG: ${{vars.TF_LOG}} # Endpoints IBMCLOUD_PI_API_ENDPOINT: ${{ vars.IBMCLOUD_PI_API_ENDPOINT }} @@ -98,25 +103,7 @@ jobs: IBMCLOUD_ZONE: ${{ vars.IBMCLOUD_ZONE }} - - - # Step 7: Upload Test Results as JUnit Report (Optional Improvement) - - name: Upload test results - if: always() - run: | - # Create a directory for the test results - mkdir -p test-results - - # Run the tests and output in JUnit format - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log - - # Convert the output into JUnit XML format - go-junit-report < test-results/test-report.log > test-results/test-report.xml - - # Make sure the test results can be uploaded - continue-on-error: true # Allow workflow to continue even if tests fail - - # Step 8: Upload Test Results (JUnit) + # Step 7: Upload Test Results (JUnit) - name: Upload JUnit test results as artifact if: always() uses: actions/upload-artifact@v3 From 6957ad2700d0cda6707391ef3ee29a8ab5a71740 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 12:24:54 -0600 Subject: [PATCH 06/22] Acceptance test: add missing env vars --- .github/workflows/power-acceptance-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 14509759d60..5bd55cc922f 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -88,6 +88,7 @@ jobs: TF_CLI_ARGS_apply: ${{ secrets.TF_CLI_ARGS_apply }} IC_API_KEY: ${{ secrets.IC_API_KEY }} IAAS_CLASSIC_API_KEY: ${{ secrets.IAAS_CLASSIC_API_KEY }} + IAAS_CLASSIC_USERNAME: ${{ secrets.IAAS_CLASSIC_USERNAME }} TF_LOG: ${{vars.TF_LOG}} # Endpoints IBMCLOUD_PI_API_ENDPOINT: ${{ vars.IBMCLOUD_PI_API_ENDPOINT }} From cbc046a0152233bcae8b6294511a526a7c0a64c6 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 12:31:20 -0600 Subject: [PATCH 07/22] Acceptance test: remove tf log --- .github/workflows/power-acceptance-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 5bd55cc922f..1ac9280ab81 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -89,7 +89,6 @@ jobs: IC_API_KEY: ${{ secrets.IC_API_KEY }} IAAS_CLASSIC_API_KEY: ${{ secrets.IAAS_CLASSIC_API_KEY }} IAAS_CLASSIC_USERNAME: ${{ secrets.IAAS_CLASSIC_USERNAME }} - TF_LOG: ${{vars.TF_LOG}} # Endpoints IBMCLOUD_PI_API_ENDPOINT: ${{ vars.IBMCLOUD_PI_API_ENDPOINT }} IBMCLOUD_IAM_API_ENDPOINT: ${{ vars.IBMCLOUD_IAM_API_ENDPOINT }} From 1ff1825a68e9a8e12a7c88444466247187d954ba Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 12:51:48 -0600 Subject: [PATCH 08/22] Acceptance test: update accpt test file --- ibm/acctest/acctest.go | 2 +- ibm/service/power/data_source_ibm_pi_image.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index dbcc0de99eb..665f55f023c 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -1074,7 +1074,7 @@ func init() { // Added for Power Colo Testing Pi_image = os.Getenv("PI_IMAGE") if Pi_image == "" { - Pi_image = "c93dc4c6-e85a-4da2-9ea6-f24576256122" + Pi_image = "5b9568e5-8e39-420e-be63-a16cf7faa98e" fmt.Println("[INFO] Set the environment variable PI_IMAGE for testing ibm_pi_image resource else it is set to default value '7200-03-03'") } Pi_sap_image = os.Getenv("PI_SAP_IMAGE") diff --git a/ibm/service/power/data_source_ibm_pi_image.go b/ibm/service/power/data_source_ibm_pi_image.go index 0975029328a..99cbb84eb8f 100644 --- a/ibm/service/power/data_source_ibm_pi_image.go +++ b/ibm/service/power/data_source_ibm_pi_image.go @@ -115,7 +115,7 @@ func dataSourceIBMPIImagesRead(ctx context.Context, d *schema.ResourceData, meta d.Set(Attr_CRN, imagedata.Crn) tags, err := flex.GetTagsUsingCRN(meta, string(imagedata.Crn)) if err != nil { - log.Printf("Error on get of pi image (%s) user_tags: %s", *imagedata.ImageID, err) + log.Printf("Error on get of pi image (%s) user_tags : %s", *imagedata.ImageID, err) } d.Set(Attr_UserTags, tags) } From 03ba601bf7df42e02331f4013b77137d0354bd69 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 13:34:10 -0600 Subject: [PATCH 09/22] Acceptance test: printing test run log --- .github/workflows/power-acceptance-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 1ac9280ab81..a5362a9f67d 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -77,7 +77,8 @@ jobs: if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log - + echo "Test Results:" + cat test-results/test-report.log go-junit-report < test-results/test-report.log > test-results/test-report.xml else echo "No modified test files detected." From 1df92204f075ede0064ad8b5eade3d6cd3e55088 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 13:37:47 -0600 Subject: [PATCH 10/22] Acceptance test: printing test run log 2 --- .github/workflows/power-acceptance-test.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index a5362a9f67d..d9ae736a12d 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -77,9 +77,7 @@ jobs: if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log - echo "Test Results:" - cat test-results/test-report.log - go-junit-report < test-results/test-report.log > test-results/test-report.xml + else echo "No modified test files detected." fi @@ -104,10 +102,9 @@ jobs: IBMCLOUD_ZONE: ${{ vars.IBMCLOUD_ZONE }} - # Step 7: Upload Test Results (JUnit) - - name: Upload JUnit test results as artifact - if: always() - uses: actions/upload-artifact@v3 - with: - name: acceptance-test-results - path: test-results/test-report.xml + # Step 7: Display Test Results + - name: Display Test Results + run: | + echo "Test Results:" + cat test-results/test-report.log + if: always() From 7443276bf365da56640c97aae1da991883beb5c2 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 14:16:18 -0600 Subject: [PATCH 11/22] Acceptance test: cleaning output --- .github/workflows/power-acceptance-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index d9ae736a12d..7e4885f96db 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -76,7 +76,7 @@ jobs: # If there are modified test files, run the tests if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files | tee test-results/test-report.log + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL)' | tee test-results/test-report.log else echo "No modified test files detected." From 76dd009df540a78f48949f12c145b5795e0d6f97 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Wed, 4 Dec 2024 16:07:28 -0600 Subject: [PATCH 12/22] Acceptance test: add check for powervs only --- .github/workflows/power-acceptance-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 7e4885f96db..a62890af60c 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -9,6 +9,7 @@ on: jobs: acceptance-test: runs-on: ubuntu-latest + if: github.repository == 'powervs-ibm/terraform-provider-ibm' steps: # Step 1: Checkout code From 6c58c969d1478ef041860859ea9347aa3306575f Mon Sep 17 00:00:00 2001 From: michaelkad Date: Thu, 5 Dec 2024 15:42:52 -0600 Subject: [PATCH 13/22] Acceptance test: test missing variables --- .github/workflows/power-acceptance-test.yml | 2 +- ibm/service/power/resource_ibm_pi_volume.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index a62890af60c..c8fab7d1203 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -1,4 +1,4 @@ -name: Run Acceptance Tests on Pull Request +name: PowerVS Acceptance Tests on: pull_request: diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index 365de4a32c7..df00e76547b 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -138,7 +138,7 @@ func ResourceIBMPIVolume() *schema.Resource { // Attributes Attr_Auxiliary: { Computed: true, - Description: "Indicates if the volume is auxiliary or not.", + Description: "Indicates if the volume is auxiliary or not .", Type: schema.TypeBool, }, Attr_AuxiliaryVolumeName: { From f7bb535d7d2a350b2384fbe4ef86910445128cc5 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Thu, 5 Dec 2024 16:04:41 -0600 Subject: [PATCH 14/22] Acceptance test: remove resource update --- ibm/service/power/resource_ibm_pi_volume.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index df00e76547b..365de4a32c7 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -138,7 +138,7 @@ func ResourceIBMPIVolume() *schema.Resource { // Attributes Attr_Auxiliary: { Computed: true, - Description: "Indicates if the volume is auxiliary or not .", + Description: "Indicates if the volume is auxiliary or not.", Type: schema.TypeBool, }, Attr_AuxiliaryVolumeName: { From ac0fa11787a88b2d8293cbbe6f2edf6605f86dff Mon Sep 17 00:00:00 2001 From: michaelkad Date: Thu, 5 Dec 2024 16:33:59 -0600 Subject: [PATCH 15/22] Acceptance test: fix display result --- .github/workflows/power-acceptance-test.yml | 13 +++++++------ ibm/service/power/resource_ibm_pi_volume.go | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index c8fab7d1203..81d1228cc56 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -77,7 +77,8 @@ jobs: # If there are modified test files, run the tests if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL)' | tee test-results/test-report.log + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | tee test-results/test-report.log + # go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL)' | tee test-results/test-report.log else echo "No modified test files detected." @@ -104,8 +105,8 @@ jobs: # Step 7: Display Test Results - - name: Display Test Results - run: | - echo "Test Results:" - cat test-results/test-report.log - if: always() + # - name: Display Test Results + # run: | + # echo "Test Results:" + # cat test-results/test-report.log + # if: always() diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index 365de4a32c7..df00e76547b 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -138,7 +138,7 @@ func ResourceIBMPIVolume() *schema.Resource { // Attributes Attr_Auxiliary: { Computed: true, - Description: "Indicates if the volume is auxiliary or not.", + Description: "Indicates if the volume is auxiliary or not .", Type: schema.TypeBool, }, Attr_AuxiliaryVolumeName: { From 0e2467c9c93d3be276a5658222fd52c692d50b66 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Thu, 5 Dec 2024 16:38:40 -0600 Subject: [PATCH 16/22] Acceptance test: fix display result 2 --- .github/workflows/power-acceptance-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index 81d1228cc56..a52e9a9b812 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -77,7 +77,9 @@ jobs: # If there are modified test files, run the tests if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | tee test-results/test-report.log + # go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | tee test-results/test-report.log + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files -json 2>&1 | tee test-results/test-report.json + # go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL)' | tee test-results/test-report.log else From 6da9d43048b970067a04df251e4b1105b2270f00 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Thu, 5 Dec 2024 16:49:06 -0600 Subject: [PATCH 17/22] Acceptance test: fix display result 3 --- .github/workflows/power-acceptance-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index a52e9a9b812..f6a72bee3d3 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -77,8 +77,10 @@ jobs: # If there are modified test files, run the tests if [ -n "$modified_test_files" ]; then echo "Modified test files: $modified_test_files" - # go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | tee test-results/test-report.log - go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files -json 2>&1 | tee test-results/test-report.json + go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | tee test-results/test-report.log + if grep -q 'FAIL' test-results/test-report.log; then + exit 1 + fi # go test -v -tags=all -test.v -test.run '^TestAcc' $modified_test_files 2>&1 | grep -E '^(=== RUN|--- PASS|--- FAIL|PASS|FAIL)' | tee test-results/test-report.log From 8a9e7a0a811b722b180cc32118f5fc85a61d2c89 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Fri, 6 Dec 2024 10:44:09 -0600 Subject: [PATCH 18/22] Acceptance test: fix display result 4 --- ibm/service/power/data_source_ibm_pi_catalog_images_test.go | 2 +- ibm/service/power/resource_ibm_pi_volume.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_catalog_images_test.go b/ibm/service/power/data_source_ibm_pi_catalog_images_test.go index f317397229f..407663a22ae 100644 --- a/ibm/service/power/data_source_ibm_pi_catalog_images_test.go +++ b/ibm/service/power/data_source_ibm_pi_catalog_images_test.go @@ -14,7 +14,7 @@ import ( func testAccCheckIBMPICatalogImagesDataSourceBasicConfig() string { return fmt.Sprintf(` - data "ibm_pi_catalog_images" "power_catalog_images_basic" { + data "ibm_pi_catalog_images" "power_catalog_images_basic " { pi_cloud_instance_id = "%s" }`, acc.Pi_cloud_instance_id) } diff --git a/ibm/service/power/resource_ibm_pi_volume.go b/ibm/service/power/resource_ibm_pi_volume.go index df00e76547b..365de4a32c7 100644 --- a/ibm/service/power/resource_ibm_pi_volume.go +++ b/ibm/service/power/resource_ibm_pi_volume.go @@ -138,7 +138,7 @@ func ResourceIBMPIVolume() *schema.Resource { // Attributes Attr_Auxiliary: { Computed: true, - Description: "Indicates if the volume is auxiliary or not .", + Description: "Indicates if the volume is auxiliary or not.", Type: schema.TypeBool, }, Attr_AuxiliaryVolumeName: { From 580f545364372ef68b0093bd328ca725a16dd423 Mon Sep 17 00:00:00 2001 From: michaelkad Date: Fri, 6 Dec 2024 11:01:32 -0600 Subject: [PATCH 19/22] Acceptance test: fix display result 5 --- .github/workflows/power-acceptance-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/power-acceptance-test.yml b/.github/workflows/power-acceptance-test.yml index f6a72bee3d3..ae7894b405e 100644 --- a/.github/workflows/power-acceptance-test.yml +++ b/.github/workflows/power-acceptance-test.yml @@ -103,7 +103,7 @@ jobs: IBMCLOUD_GS_API_ENDPOINT: ${{ vars.IBMCLOUD_GS_API_ENDPOINT }} IBMCLOUD_GT_API_ENDPOINT: ${{ vars.IBMCLOUD_GT_API_ENDPOINT }} # Power - PI_CLOUDINSTANCE_ID: ${{ vars.PI_CLOUDINSTANCE_ID }} + PI_CLOUDINSTANCE_ID: ${{ secrets.PI_CLOUDINSTANCE_ID }} IBMCLOUD_REGION: ${{ vars.IBMCLOUD_REGION }} IBMCLOUD_ZONE: ${{ vars.IBMCLOUD_ZONE }} From 8db325fe88de508059cef444083adfb4b2c042df Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Fri, 6 Dec 2024 12:34:46 -0600 Subject: [PATCH 20/22] Acceptance test: fix display result 6 --- ibm/acctest/acctest.go | 2 +- ibm/service/power/data_source_ibm_pi_image.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 665f55f023c..0910799d10a 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -1074,7 +1074,7 @@ func init() { // Added for Power Colo Testing Pi_image = os.Getenv("PI_IMAGE") if Pi_image == "" { - Pi_image = "5b9568e5-8e39-420e-be63-a16cf7faa98e" + Pi_image = "5b9568e5-8e39-420e-be63-a16cf7faa98f" fmt.Println("[INFO] Set the environment variable PI_IMAGE for testing ibm_pi_image resource else it is set to default value '7200-03-03'") } Pi_sap_image = os.Getenv("PI_SAP_IMAGE") diff --git a/ibm/service/power/data_source_ibm_pi_image.go b/ibm/service/power/data_source_ibm_pi_image.go index 99cbb84eb8f..6f14bda4bd8 100644 --- a/ibm/service/power/data_source_ibm_pi_image.go +++ b/ibm/service/power/data_source_ibm_pi_image.go @@ -115,7 +115,7 @@ func dataSourceIBMPIImagesRead(ctx context.Context, d *schema.ResourceData, meta d.Set(Attr_CRN, imagedata.Crn) tags, err := flex.GetTagsUsingCRN(meta, string(imagedata.Crn)) if err != nil { - log.Printf("Error on get of pi image (%s) user_tags : %s", *imagedata.ImageID, err) + log.Printf("Error on get of pi image (%s) user_tags : %s", *imagedata.ImageID, err) } d.Set(Attr_UserTags, tags) } From 42ccb8764f0af41ac4efab2f41fc848afa97c301 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Mon, 9 Dec 2024 10:39:44 -0600 Subject: [PATCH 21/22] Acceptance test: fix display result 7 --- ibm/acctest/acctest.go | 2 +- ibm/service/power/data_source_ibm_pi_image.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 0910799d10a..665f55f023c 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -1074,7 +1074,7 @@ func init() { // Added for Power Colo Testing Pi_image = os.Getenv("PI_IMAGE") if Pi_image == "" { - Pi_image = "5b9568e5-8e39-420e-be63-a16cf7faa98f" + Pi_image = "5b9568e5-8e39-420e-be63-a16cf7faa98e" fmt.Println("[INFO] Set the environment variable PI_IMAGE for testing ibm_pi_image resource else it is set to default value '7200-03-03'") } Pi_sap_image = os.Getenv("PI_SAP_IMAGE") diff --git a/ibm/service/power/data_source_ibm_pi_image.go b/ibm/service/power/data_source_ibm_pi_image.go index 6f14bda4bd8..bbcf890df21 100644 --- a/ibm/service/power/data_source_ibm_pi_image.go +++ b/ibm/service/power/data_source_ibm_pi_image.go @@ -21,7 +21,7 @@ func DataSourceIBMPIImage() *schema.Resource { Schema: map[string]*schema.Schema{ // Arguments Arg_CloudInstanceID: { - Description: "The GUID of the service instance associated with an account.", + Description: "The GUID of the service instance associated with an account .", Required: true, Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, @@ -115,7 +115,7 @@ func dataSourceIBMPIImagesRead(ctx context.Context, d *schema.ResourceData, meta d.Set(Attr_CRN, imagedata.Crn) tags, err := flex.GetTagsUsingCRN(meta, string(imagedata.Crn)) if err != nil { - log.Printf("Error on get of pi image (%s) user_tags : %s", *imagedata.ImageID, err) + log.Printf("Error on get of pi image (%s) user_tags : %s", *imagedata.ImageID, err) } d.Set(Attr_UserTags, tags) } From 18ffc3b29e9c861b2a4c20a58f2974caef9c5a6e Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Mon, 9 Dec 2024 10:47:56 -0600 Subject: [PATCH 22/22] Acceptance test: fix display result 8 --- ibm/service/power/data_source_ibm_pi_image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/power/data_source_ibm_pi_image.go b/ibm/service/power/data_source_ibm_pi_image.go index bbcf890df21..da6a6f27aa8 100644 --- a/ibm/service/power/data_source_ibm_pi_image.go +++ b/ibm/service/power/data_source_ibm_pi_image.go @@ -21,7 +21,7 @@ func DataSourceIBMPIImage() *schema.Resource { Schema: map[string]*schema.Schema{ // Arguments Arg_CloudInstanceID: { - Description: "The GUID of the service instance associated with an account .", + Description: "The GUID of the service instance associated with an account .", Required: true, Type: schema.TypeString, ValidateFunc: validation.NoZeroValues,