Skip to content

Commit

Permalink
Switch tests to ginkgo
Browse files Browse the repository at this point in the history
It's easier to test CLIs with ginkgo and it makes it
easy to assert on the output, rather than metrics. Validating
metrics is tricky, because tests are run concurrently
  • Loading branch information
mkuratczyk committed Nov 18, 2024
1 parent 1ced5aa commit 3856cbe
Show file tree
Hide file tree
Showing 15 changed files with 590 additions and 754 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ env:
TEST_STATS_DELAY: 5000

jobs:
golangci:
name: lint
lint:
name: Lint
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
run: OMQ_RABBITMQCTL=DOCKER:${{job.services.rabbitmq.id}} bin/ci/before_build.sh

- name: Run go test
run: go test -count=1 -p 1 -v ./...
run: go run github.com/onsi/ginkgo/v2/ginkgo -r --randomize-all --randomize-suites --fail-on-pending --fail-on-empty --keep-going --race --trace
13 changes: 13 additions & 0 deletions cmd/cmd_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cmd_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestCmd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "CMD Suite")
}
Loading

0 comments on commit 3856cbe

Please sign in to comment.