Skip to content

Commit 0256333

Browse files
authored
Add test for junit timeout error from Go (#6)
1 parent 4858350 commit 0256333

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

main_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssu
5656
github.com/stackrox/rox/pkg/booleanpolicy/evaluator / TestDifferentBaseTypes FAILED
5757
github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssuerIntegrationTests FAILED
5858
github.com/stackrox/rox/central/resourcecollection/datastore/store/postgres / TestCollectionsStore FAILED
59+
command-line-arguments / TestTimeout FAILED
5960
`,
6061
JobName: "job-name",
6162
BuildId: "1",
@@ -126,6 +127,13 @@ github.com/stackrox/rox/central/resourcecollection/datastore/store/postgres / Te
126127
Error: " env_isolator.go:41: EnvIsolator: Setting ROX_POSTGRES_DATASTORE to true\nSub test TestCollectionsStore/TestStore: store_test.go:47: collections TRUNCATE TABLE\n store_test.go:95:\n \tError Trace:\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store_test.go:95\n \tError: \tReceived unexpected error:\n \t \tERROR: update or delete on table \"collections\" violates foreign key constraint \"fk_collections_embedded_collections_collections_cycle_ref\" on table \"collections_embedded_collections\" (SQLSTATE 23503)\n \t \tcould not delete from \"collections\"\n \t \tgithub.com/stackrox/rox/pkg/search/postgres.RunDeleteRequestForSchema.func1\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/search/postgres/common.go:833\n \t \tgithub.com/stackrox/rox/pkg/postgres/pgutils.Retry.func1\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/postgres/pgutils/retry.go:21\n \t \tgithub.com/stackrox/rox/pkg/postgres/pgutils.Retry2[...].func1\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/postgres/pgutils/retry.go:32\n \t \tgithub.com/stackrox/rox/pkg/postgres/pgutils.Retry3[...]\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/postgres/pgutils/retry.go:43\n \t \tgithub.com/stackrox/rox/pkg/postgres/pgutils.Retry2[...]\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/postgres/pgutils/retry.go:35\n \t \tgithub.com/stackrox/rox/pkg/postgres/pgutils.Retry\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/postgres/pgutils/retry.go:23\n \t \tgithub.com/stackrox/rox/pkg/search/postgres.RunDeleteRequestForSchema\n \t \t\t/go/src/github.com/stackrox/stackrox/pkg/search/postgres/common.go:830\n \t \tgithub.com/stackrox/rox/central/resourcecollection/datastore/store/postgres.(*storeImpl).Delete\n \t \t\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store.go:429\n \t \tgithub.com/stackrox/rox/central/resourcecollection/datastore/store/postgres.(*CollectionsStoreSuite).TestStore\n \t \t\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store_test.go:95\n \t \treflect.Value.call\n \t \t\t/usr/local/go/src/reflect/value.go:556\n \t \treflect.Value.Call\n \t \t\t/usr/local/go/src/reflect/value.go:339\n \t \tgithub.com/stretchr/testify/suite.Run.func1\n \t \t\t/go/pkg/mod/github.com/stretchr/testify@v1.8.0/suite/suite.go:175\n \t \ttesting.tRunner\n \t \t\t/usr/local/go/src/testing/testing.go:1439\n \t \truntime.goexit\n \t \t\t/usr/local/go/src/runtime/asm_amd64.s:1571\n \tTest: \tTestCollectionsStore/TestStore\n store_test.go:98:\n \tError Trace:\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store_test.go:98\n \tError: \tShould be false\n \tTest: \tTestCollectionsStore/TestStore\n store_test.go:99:\n \tError Trace:\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store_test.go:99\n \tError: \tExpected nil, but got: &storage.ResourceCollection{Id:\"a\", Name:\"a\", Description:\"a\", CreatedAt:&types.Timestamp{Seconds: 1,\n \t \tNanos: 1,\n \t \t}, LastUpdated:&types.Timestamp{Seconds: 1,\n \t \tNanos: 1,\n \t \t}, CreatedBy:(*storage.SlimUser)(0xc00085fb00), UpdatedBy:(*storage.SlimUser)(0xc00085fb40), ResourceSelectors:[]*storage.ResourceSelector{(*storage.ResourceSelector)(0xc00085fb80)}, EmbeddedCollections:[]*storage.ResourceCollection_EmbeddedResourceCollection{(*storage.ResourceCollection_EmbeddedResourceCollection)(0xc0011e00f0)}, XXX_NoUnkeyedLiteral:struct {}{}, XXX_unrecognized:[]uint8(nil), XXX_sizecache:0}\n \tTest: \tTestCollectionsStore/TestStore\n store_test.go:114:\n \tError Trace:\t/go/src/github.com/stackrox/stackrox/central/resourcecollection/datastore/store/postgres/store_test.go:114\n \tError: \tNot equal:\n \t \texpected: 200\n \t \tactual : 201\n \tTest: \tTestCollectionsStore/TestStore",
127128
BuildId: "1",
128129
},
130+
{
131+
Name: "TestTimeout",
132+
Suite: "command-line-arguments",
133+
Message: "No test result found",
134+
Error: "panic: test timed out after 1ns\n\ngoroutine 7 [running]:\ntesting.(*M).startAlarm.func1()\n\t/snap/go/10030/src/testing/testing.go:2036 +0x8e\ncreated by time.goFunc\n\t/snap/go/10030/src/time/sleep.go:176 +0x32\n\ngoroutine 1 [chan receive]:\ntesting.(*T).Run(0xc0000076c0, {0x5254af?, 0x4b7c05?}, 0x52f280)\n\t/snap/go/10030/src/testing/testing.go:1494 +0x37a\ntesting.runTests.func1(0xc00007e390?)\n\t/snap/go/10030/src/testing/testing.go:1846 +0x6e\ntesting.tRunner(0xc0000076c0, 0xc000104cd8)\n\t/snap/go/10030/src/testing/testing.go:1446 +0x10b\ntesting.runTests(0xc000000140?, {0x5fde10, 0x1, 0x1}, {0x7f398ed8a108?, 0x40?, 0x606c20?})\n\t/snap/go/10030/src/testing/testing.go:1844 +0x456\ntesting.(*M).Run(0xc000000140)\n\t/snap/go/10030/src/testing/testing.go:1726 +0x5d9\nmain.main()\n\t_testmain.go:47 +0x1aa\n\ngoroutine 6 [runnable]:\ntesting.pcToName(0x4b7dd4)\n\t/snap/go/10030/src/testing/testing.go:1226 +0x3d\ntesting.callerName(0x0?)\n\t/snap/go/10030/src/testing/testing.go:1222 +0x45\ntesting.tRunner(0xc000007860, 0x52f280)\n\t/snap/go/10030/src/testing/testing.go:1307 +0x34\ncreated by testing.(*T).Run\n\t/snap/go/10030/src/testing/testing.go:1493 +0x35f",
135+
BuildId: "1",
136+
},
129137
},
130138
tests,
131139
)

testdata/timeout.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites tests="1" errors="1">
3+
<testsuite name="command-line-arguments" tests="1" failures="0" errors="1" id="0" >
4+
<testcase name="TestTimeout" classname="command-line-arguments" time="0.000">
5+
<error message="No test result found"><![CDATA[panic: test timed out after 1ns
6+
7+
goroutine 7 [running]:
8+
testing.(*M).startAlarm.func1()
9+
/snap/go/10030/src/testing/testing.go:2036 +0x8e
10+
created by time.goFunc
11+
/snap/go/10030/src/time/sleep.go:176 +0x32
12+
13+
goroutine 1 [chan receive]:
14+
testing.(*T).Run(0xc0000076c0, {0x5254af?, 0x4b7c05?}, 0x52f280)
15+
/snap/go/10030/src/testing/testing.go:1494 +0x37a
16+
testing.runTests.func1(0xc00007e390?)
17+
/snap/go/10030/src/testing/testing.go:1846 +0x6e
18+
testing.tRunner(0xc0000076c0, 0xc000104cd8)
19+
/snap/go/10030/src/testing/testing.go:1446 +0x10b
20+
testing.runTests(0xc000000140?, {0x5fde10, 0x1, 0x1}, {0x7f398ed8a108?, 0x40?, 0x606c20?})
21+
/snap/go/10030/src/testing/testing.go:1844 +0x456
22+
testing.(*M).Run(0xc000000140)
23+
/snap/go/10030/src/testing/testing.go:1726 +0x5d9
24+
main.main()
25+
_testmain.go:47 +0x1aa
26+
27+
goroutine 6 [runnable]:
28+
testing.pcToName(0x4b7dd4)
29+
/snap/go/10030/src/testing/testing.go:1226 +0x3d
30+
testing.callerName(0x0?)
31+
/snap/go/10030/src/testing/testing.go:1222 +0x45
32+
testing.tRunner(0xc000007860, 0x52f280)
33+
/snap/go/10030/src/testing/testing.go:1307 +0x34
34+
created by testing.(*T).Run
35+
/snap/go/10030/src/testing/testing.go:1493 +0x35f]]></error>
36+
</testcase>
37+
</testsuite>
38+
</testsuites>

0 commit comments

Comments
 (0)