Skip to content

Commit

Permalink
Publish test report (jaegertracing#5030)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Resolves jaegertracing#2859

## Description of the changes
- Publish unit test results using
https://github.com/EnricoMi/publish-unit-test-result-action

## How was this change tested?
- Tested in my fork:
https://github.com/albertteoh/jaeger/actions/runs/7312986726

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits

---------

Signed-off-by: Albert Teoh <albert@packsmith.io>
Co-authored-by: Albert Teoh <albert@packsmith.io>
  • Loading branch information
albertteoh and Albert Teoh authored Dec 24, 2023
1 parent 9bd8317 commit cf917dd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci-unit-tests-go-tip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ jobs:
- name: Install Go Tip
uses: ./.github/actions/setup-go-tip

- name: Install tools
run: make install-test-tools

- name: Run unit tests
run: make test-ci

- name: Publish Unit Test Summary 📑
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Unit Tests Summary
junit_files: junit-report.xml

- name: Lint
run: echo skip linting on Go tip
7 changes: 7 additions & 0 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ jobs:
- name: Run unit tests
run: make test-ci

- name: Publish Unit Test Summary 📑
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Unit Tests Summary
junit_files: junit-report.xml

- name: Setup CODECOV_TOKEN
uses: ./.github/actions/setup-codecov

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ deploy-staging/
sha256sum.combined.txt
resource.syso
.gocache
test-results.json
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ index-rollover-integration-test: docker-images-elastic

.PHONY: cover
cover: nocover
$(GOTEST) -tags=memory_storage_integration -timeout 5m -coverprofile cover.out ./...
$(GOTEST) -tags=memory_storage_integration -timeout 5m -coverprofile cover.out ./... > test-results.json
go tool cover -html=cover.out -o cover.html

.PHONY: nocover
Expand Down Expand Up @@ -494,6 +494,7 @@ draft-release:
install-test-tools:
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
$(GO) install mvdan.cc/gofumpt@latest
$(GO) install github.com/jstemmer/go-junit-report/v2@latest

.PHONY: install-build-tools
install-build-tools:
Expand All @@ -507,8 +508,12 @@ install-tools: install-test-tools install-build-tools
install-ci: install-test-tools install-build-tools

.PHONY: test-ci
test-ci: GOTEST := $(GOTEST_QUIET)
test-ci: build-examples cover
test-ci: GOTEST := $(GOTEST_QUIET) -json
test-ci: install-test-tools build-examples cover test-report

.PHONY: test-report
test-report:
cat test-results.json | go-junit-report -parser gojson > junit-report.xml

.PHONY: thrift
thrift: idl/thrift/jaeger.thrift thrift-image
Expand Down
21 changes: 11 additions & 10 deletions model/keyvalue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,25 @@ func TestKeyValueAsStringAndValue(t *testing.T) {
expectedBinaryStr := `42656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f6472696775657320`
expectedBinaryStrLossy := `42656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565732042656e6465722042656e64696e6720526f647269677565730a0942656e6465722042656e64696e6720526f647269677565732042656e64...`
testCases := []struct {
name string
kv model.KeyValue
str string
strLossy string
val interface{}
}{
{kv: model.String("x", "Bender is great!"), str: "Bender is great!", val: "Bender is great!"},
{kv: model.Bool("x", false), str: "false", val: false},
{kv: model.Bool("x", true), str: "true", val: true},
{kv: model.Int64("x", 3000), str: "3000", val: int64(3000)},
{kv: model.Int64("x", -1947), str: "-1947", val: int64(-1947)},
{kv: model.Float64("x", 3.14159265359), str: "3.141592654", val: float64(3.14159265359)},
{kv: model.Binary("x", []byte("Bender")), str: "42656e646572", val: []byte("Bender")},
{kv: model.Binary("x", []byte(longString)), str: expectedBinaryStr, val: []byte(longString)},
{kv: model.Binary("x", []byte(longString)), strLossy: expectedBinaryStrLossy, val: []byte(longString)},
{name: "Bender is great!", kv: model.String("x", "Bender is great!"), str: "Bender is great!", val: "Bender is great!"},
{name: "false", kv: model.Bool("x", false), str: "false", val: false},
{name: "true", kv: model.Bool("x", true), str: "true", val: true},
{name: "3000", kv: model.Int64("x", 3000), str: "3000", val: int64(3000)},
{name: "-1947", kv: model.Int64("x", -1947), str: "-1947", val: int64(-1947)},
{name: "3.141592654", kv: model.Float64("x", 3.14159265359), str: "3.141592654", val: float64(3.14159265359)},
{name: "42656e646572", kv: model.Binary("x", []byte("Bender")), str: "42656e646572", val: []byte("Bender")},
{name: "binary string", kv: model.Binary("x", []byte(longString)), str: expectedBinaryStr, val: []byte(longString)},
{name: "binary string (lossy)", kv: model.Binary("x", []byte(longString)), strLossy: expectedBinaryStrLossy, val: []byte(longString)},
}
for _, tt := range testCases {
testCase := tt // capture loop var
t.Run(testCase.str, func(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
if testCase.strLossy != "" {
assert.Equal(t, testCase.strLossy, testCase.kv.AsStringLossy())
} else {
Expand Down

0 comments on commit cf917dd

Please sign in to comment.