From 8ca860b8934036d2600eddbdf06cc7c897b9c591 Mon Sep 17 00:00:00 2001 From: samitab Date: Thu, 23 May 2024 14:22:36 +1000 Subject: [PATCH] [ignore] Test go client code change to avoid race condition. --- .github/workflows/checks.yml | 12 +++++------- .../ciscoecosystem/aci-go-client/v2/client/client.go | 11 ++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0550f4807..135e00f38 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,10 +21,10 @@ jobs: - run: chmod +x ./scripts/gofmtcheck.sh - name: gofmt Check run: ./scripts/gofmtcheck.sh - - run: go mod tidy - - run: go mod vendor - - name: Check vendor for changes - run: git diff --exit-code + # - run: go mod tidy + # - run: go mod vendor + # - name: Check vendor for changes + # run: git diff --exit-code - name: Build run: go build -v @@ -76,9 +76,7 @@ jobs: terraform_version: '1.7.*' terraform_wrapper: false - name: Terraform Acceptance Test (APIC ${{ matrix.apic_host.name }}) - # TODO: Fix TestAccAciRestManaged_importWithIpv6 to resolve data race failures occurring in the CI - # https://github.com/CiscoDevNet/terraform-provider-aci/issues/1218 - run: go test github.com/CiscoDevNet/terraform-provider-aci/v2/internal/provider -v -race -timeout 300m -coverprofile=coverage.out -covermode=atomic -skip TestAccAciRestManaged_importWithIpv6 + run: go test github.com/CiscoDevNet/terraform-provider-aci/v2/internal/provider -v -race -timeout 300m -coverprofile=coverage.out -covermode=atomic -run TestAccAciRestManaged_importWithIpv6 env: TF_ACC: '1' TF_ACC_STATE_LINEAGE: '1' diff --git a/vendor/github.com/ciscoecosystem/aci-go-client/v2/client/client.go b/vendor/github.com/ciscoecosystem/aci-go-client/v2/client/client.go index fdc4fe139..55a4bcaa8 100644 --- a/vendor/github.com/ciscoecosystem/aci-go-client/v2/client/client.go +++ b/vendor/github.com/ciscoecosystem/aci-go-client/v2/client/client.go @@ -354,7 +354,6 @@ func (c *Client) MakeRestRequestRaw(method string, rpath string, payload []byte, if err != nil { return nil, err } - if c.skipLoggingPayload { log.Printf("HTTP request %s %s", method, rpath) } else { @@ -366,7 +365,6 @@ func (c *Client) MakeRestRequestRaw(method string, rpath string, payload []byte, return req, err } } - if !c.skipLoggingPayload { log.Printf("HTTP request after injection %s %s %v", method, rpath, req) } @@ -408,12 +406,13 @@ func (c *Client) MakeRestRequest(method string, rpath string, body *container.Co if err != nil { return nil, err } - + c.l.Lock() if c.skipLoggingPayload { log.Printf("HTTP request %s %s", method, rpath) } else { log.Printf("HTTP request %s %s %v", method, rpath, req) } + c.l.Unlock() if authenticated { req, err = c.InjectAuthenticationHeader(req, rpath) if err != nil { @@ -421,9 +420,11 @@ func (c *Client) MakeRestRequest(method string, rpath string, body *container.Co } } + c.l.Lock() if !c.skipLoggingPayload { log.Printf("HTTP request after injection %s %s %v", method, rpath, req) } + c.l.Unlock() return req, nil } @@ -452,7 +453,7 @@ func (c *Client) Authenticate() error { } // Setting skipLoggingPayload true so authentication details are not shown in logs - c.skipLoggingPayload = true + SkipLoggingPayload(true)(c) req, err := c.MakeRestRequestRaw(method, path, body, authenticated) if err != nil { @@ -461,7 +462,7 @@ func (c *Client) Authenticate() error { obj, _, err := c.Do(req) - c.skipLoggingPayload = skipLoggingPayloadState + SkipLoggingPayload(skipLoggingPayloadState)(c) if err != nil { log.Printf("[DEBUG] Authentication ERROR: %s", err)