From 3637d90cb38b34f1ac1cf3be7d966af6983231c8 Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 4 Dec 2024 07:45:15 -0800 Subject: [PATCH] fix: nil pointer in saucectl configure command (#987) * fix: nil pointer in saucectl configure command * ci: test saucectl configure e2e --- .github/workflows/test.yml | 19 +++++++++++++++++++ internal/cmd/configure/cmd.go | 1 - internal/usage/client.go | 4 +++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b56db134c..c24ec833f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,6 +106,25 @@ jobs: saucectl saucectl.exe + test-configure: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Download saucectl Binary + uses: actions/download-artifact@v4 + with: + name: saucectlbin + + - name: Set Permissions + run: chmod +x ./saucectl + + - name: Saucectl Configure + run: ./saucectl configure -u $SAUCE_USERNAME -a $SAUCE_ACCESS_KEY + puppeteer-replay: needs: build runs-on: ubuntu-latest diff --git a/internal/cmd/configure/cmd.go b/internal/cmd/configure/cmd.go index 44dec2b3b..0ad1eab60 100644 --- a/internal/cmd/configure/cmd.go +++ b/internal/cmd/configure/cmd.go @@ -41,7 +41,6 @@ func Command() *cobra.Command { go func() { tracker.Collect( cmds.FullName(cmd), - nil, ) _ = tracker.Close() }() diff --git a/internal/usage/client.go b/internal/usage/client.go index be2b6564e..945815fff 100644 --- a/internal/usage/client.go +++ b/internal/usage/client.go @@ -73,7 +73,9 @@ func (c *Client) Collect(subject string, opts ...Option) { Set("ci", ci.GetProvider().Name) for _, opt := range opts { - opt(p) + if opt != nil { + opt(p) + } } userID := credentials.Get().Username