Skip to content

Commit

Permalink
Add test for junit timeout error from Go (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
janisz authored Jan 20, 2023
1 parent 4858350 commit 0256333
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssu
github.com/stackrox/rox/pkg/booleanpolicy/evaluator / TestDifferentBaseTypes FAILED
github.com/stackrox/rox/sensor/kubernetes/localscanner / TestLocalScannerTLSIssuerIntegrationTests FAILED
github.com/stackrox/rox/central/resourcecollection/datastore/store/postgres / TestCollectionsStore FAILED
command-line-arguments / TestTimeout FAILED
`,
JobName: "job-name",
BuildId: "1",
Expand Down Expand Up @@ -126,6 +127,13 @@ github.com/stackrox/rox/central/resourcecollection/datastore/store/postgres / Te
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/[email protected]/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",
BuildId: "1",
},
{
Name: "TestTimeout",
Suite: "command-line-arguments",
Message: "No test result found",
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",
BuildId: "1",
},
},
tests,
)
Expand Down
38 changes: 38 additions & 0 deletions testdata/timeout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" errors="1">
<testsuite name="command-line-arguments" tests="1" failures="0" errors="1" id="0" >
<testcase name="TestTimeout" classname="command-line-arguments" time="0.000">
<error message="No test result found"><![CDATA[panic: test timed out after 1ns
goroutine 7 [running]:
testing.(*M).startAlarm.func1()
/snap/go/10030/src/testing/testing.go:2036 +0x8e
created by time.goFunc
/snap/go/10030/src/time/sleep.go:176 +0x32
goroutine 1 [chan receive]:
testing.(*T).Run(0xc0000076c0, {0x5254af?, 0x4b7c05?}, 0x52f280)
/snap/go/10030/src/testing/testing.go:1494 +0x37a
testing.runTests.func1(0xc00007e390?)
/snap/go/10030/src/testing/testing.go:1846 +0x6e
testing.tRunner(0xc0000076c0, 0xc000104cd8)
/snap/go/10030/src/testing/testing.go:1446 +0x10b
testing.runTests(0xc000000140?, {0x5fde10, 0x1, 0x1}, {0x7f398ed8a108?, 0x40?, 0x606c20?})
/snap/go/10030/src/testing/testing.go:1844 +0x456
testing.(*M).Run(0xc000000140)
/snap/go/10030/src/testing/testing.go:1726 +0x5d9
main.main()
_testmain.go:47 +0x1aa
goroutine 6 [runnable]:
testing.pcToName(0x4b7dd4)
/snap/go/10030/src/testing/testing.go:1226 +0x3d
testing.callerName(0x0?)
/snap/go/10030/src/testing/testing.go:1222 +0x45
testing.tRunner(0xc000007860, 0x52f280)
/snap/go/10030/src/testing/testing.go:1307 +0x34
created by testing.(*T).Run
/snap/go/10030/src/testing/testing.go:1493 +0x35f]]></error>
</testcase>
</testsuite>
</testsuites>

0 comments on commit 0256333

Please sign in to comment.