From fb171e735fab5899b98d0952f7ee155a8dc447df Mon Sep 17 00:00:00 2001 From: atye Date: Mon, 26 Feb 2024 15:54:37 -0500 Subject: [PATCH 1/3] fix unit tests --- client_options_test.go | 3 ++- client_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client_options_test.go b/client_options_test.go index ecdc5e4..4863d08 100644 --- a/client_options_test.go +++ b/client_options_test.go @@ -21,6 +21,7 @@ package gopowerstore import ( "testing" + "github.com/dell/gopowerstore/api" "github.com/stretchr/testify/assert" ) @@ -40,5 +41,5 @@ func TestClientOptions_DefaultTimeout(t *testing.T) { func TestClientOptions_RequestIDKey(t *testing.T) { co := NewClientOptions() co.SetRequestIDKey("foobar") - assert.Equal(t, "foobar", co.RequestIDKey()) + assert.Equal(t, api.ContextKey("foobar"), co.RequestIDKey()) } diff --git a/client_test.go b/client_test.go index ca63b04..36e5279 100644 --- a/client_test.go +++ b/client_test.go @@ -23,6 +23,7 @@ import ( "os" "testing" + "github.com/dell/gopowerstore/api" "github.com/stretchr/testify/assert" ) @@ -59,5 +60,5 @@ func TestNewClient(t *testing.T) { func TestClientIMPL_SetTraceID(t *testing.T) { ctx := context.Background() ctx = C.SetTraceID(ctx, "123") - assert.Equal(t, "123", ctx.Value(clientOptionsDefaultRequestIDKey)) + assert.Equal(t, "123", ctx.Value(api.ContextKey(clientOptionsDefaultRequestIDKey))) } From 83780376a5ab07ed9a626fba1138413bfc4516cc Mon Sep 17 00:00:00 2001 From: atye Date: Mon, 26 Feb 2024 16:09:56 -0500 Subject: [PATCH 2/3] cast as string --- client_options_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client_options_test.go b/client_options_test.go index 4863d08..1459da9 100644 --- a/client_options_test.go +++ b/client_options_test.go @@ -21,7 +21,6 @@ package gopowerstore import ( "testing" - "github.com/dell/gopowerstore/api" "github.com/stretchr/testify/assert" ) @@ -41,5 +40,5 @@ func TestClientOptions_DefaultTimeout(t *testing.T) { func TestClientOptions_RequestIDKey(t *testing.T) { co := NewClientOptions() co.SetRequestIDKey("foobar") - assert.Equal(t, api.ContextKey("foobar"), co.RequestIDKey()) + assert.Equal(t, "foobar", string(co.RequestIDKey())) } From 989f8cabdcc56a5dea3887d5213c47bf017db31e Mon Sep 17 00:00:00 2001 From: atye Date: Mon, 26 Feb 2024 16:36:50 -0500 Subject: [PATCH 3/3] update workflow env --- .github/workflows/actions.yml | 6 +++--- .github/workflows/linters.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index c32df95..d2c6914 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run the forbidden words scan uses: dell/common-github-actions/code-sanitizer@main with: @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run Go Security uses: securego/gosec@master with: @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run malware scan uses: dell/common-github-actions/malware-scanner@main with: diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index e7aad32..cc151df 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -14,17 +14,17 @@ jobs: name: golangci-lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" cache: false - name: Checkout the code - uses: actions/checkout@v3.2.0 + uses: actions/checkout@v4 - name: Vendor packages run: | go mod vendor - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: v1.53 skip-cache: true