Skip to content

Commit

Permalink
Test go 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Aug 28, 2018
1 parent 8fced02 commit 9dc8d56
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ jobs:
- store_test_results:
path: junit/

test-golang-1.11:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
steps:
- checkout
- setup_remote_docker
- run:
name: "Unit Test GO 1.11"
command: |
scripts/ci/test 1.11-alpine
mkdir -p junit/gotest
docker cp \
test-$CIRCLE_BUILD_NUM:/go/src/gotest.tools/gotestsum/junit.xml \
junit/gotest/junit.xml
- store_test_results:
path: junit/

release:
docker: [{image: 'circleci/golang:1.10'}]
working_directory: /go/src/gotest.tools/gotestsum
Expand All @@ -67,6 +85,7 @@ workflows:
jobs:
- lint
- test-golang-1.10
- test-golang-1.11
- release:
filters:
tags: {only: '/v[0-9]+(\.[0-9]+)*/'}
Expand Down
4 changes: 3 additions & 1 deletion internal/junitxml/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ func generate(exec *testjson.Execution) JUnitTestSuites {
return suites
}

var goVersion = runtime.Version()

func packageProperties() []JUnitProperty {
return []JUnitProperty{
{Name: "go.version", Value: runtime.Version()},
{Name: "go.version", Value: goVersion},
}
}

Expand Down
9 changes: 9 additions & 0 deletions internal/junitxml/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestWrite(t *testing.T) {
out := new(bytes.Buffer)
exec := createExecution(t)

defer patchGoVersion("go7.7.7")()
err := Write(out, exec)
assert.NilError(t, err)
golden.Assert(t, out.String(), "junitxml-report.golden")
Expand Down Expand Up @@ -45,3 +46,11 @@ func (s *noopHandler) Event(testjson.TestEvent, *testjson.Execution) error {
func (s *noopHandler) Err(string) error {
return nil
}

func patchGoVersion(version string) func() {
orig := goVersion
goVersion = version
return func() {
goVersion = orig
}
}
6 changes: 3 additions & 3 deletions internal/junitxml/testdata/junitxml-report.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<testsuites>
<testsuite tests="0" failures="0" time="0.000s" name="github.com/gotestyourself/gotestyourself/testjson/internal/badmain">
<properties>
<property name="go.version" value="go1.10.3"></property>
<property name="go.version" value="go7.7.7"></property>
</properties>
<testcase classname="." name="TestMain" time="0.000s">
<failure message="Failed" type="">sometimes main can exit 2&#xA;FAIL&#x9;github.com/gotestyourself/gotestyourself/testjson/internal/badmain&#x9;0.010s&#xA;</failure>
</testcase>
</testsuite>
<testsuite tests="18" failures="0" time="0.020s" name="github.com/gotestyourself/gotestyourself/testjson/internal/good">
<properties>
<property name="go.version" value="go1.10.3"></property>
<property name="go.version" value="go7.7.7"></property>
</properties>
<testcase classname="good" name="TestSkipped" time="0.000s">
<skipped message="=== RUN TestSkipped&#xA;--- SKIP: TestSkipped (0.00s)&#xA;&#x9;good_test.go:23: &#xA;"></skipped>
Expand All @@ -37,7 +37,7 @@
</testsuite>
<testsuite tests="28" failures="4" time="0.020s" name="github.com/gotestyourself/gotestyourself/testjson/internal/stub">
<properties>
<property name="go.version" value="go1.10.3"></property>
<property name="go.version" value="go7.7.7"></property>
</properties>
<testcase classname="stub" name="TestFailed" time="0.000s">
<failure message="Failed" type="">=== RUN TestFailed&#xA;--- FAIL: TestFailed (0.00s)&#xA;&#x9;stub_test.go:34: this failed&#xA;</failure>
Expand Down

0 comments on commit 9dc8d56

Please sign in to comment.