Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark tests marked as error when no unit test found #174

Open
janisz opened this issue Oct 26, 2023 · 1 comment
Open

benchmark tests marked as error when no unit test found #174

janisz opened this issue Oct 26, 2023 · 1 comment

Comments

@janisz
Copy link
Contributor

janisz commented Oct 26, 2023

For following test output:

CGO_ENABLED is not 0. Compiling with -linkmode=external
goos: linux
goarch: amd64
pkg: github.com/stackrox/rox/central/administration/events/datastore
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
BenchmarkDatastore_Add_and_Flush
BenchmarkDatastore_Add_and_Flush/add_1000_events_to_the_writer_and_flush_it
BenchmarkDatastore_Add_and_Flush/add_1000_events_to_the_writer_and_flush_it-2         	       1	  11813052 ns/op	 2719272 B/op   32634 allocs/op
BenchmarkDatastore_Add_and_Flush/add_5000_events_to_the_writer_and_flush_it
BenchmarkDatastore_Add_and_Flush/add_5000_events_to_the_writer_and_flush_it-2         	       1	  99072938 ns/op	16966048 B/op  216477 allocs/op
BenchmarkDatastore_Add_and_Flush/add_10000_events_to_the_writer_and_flush_it
BenchmarkDatastore_Add_and_Flush/add_10000_events_to_the_writer_and_flush_it-2        	       1	 184645515 ns/op	33935608 B/op  432925 allocs/op
BenchmarkDatastore_Add_and_Flush/add_20000_events_to_the_writer_and_flush_it
BenchmarkDatastore_Add_and_Flush/add_20000_events_to_the_writer_and_flush_it-2        	       1	 368453326 ns/op	67923280 B/op  865761 allocs/op
PASS

Get:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" errors="1">
	<testsuite name="" tests="5" failures="0" errors="1" id="0" time="0.664" timestamp="2023-10-26T18:51:22+02:00">
		<testcase name="BenchmarkDatastore_Add_and_Flush" classname="" time="0.000">
			<error message="No test result found"></error>
		</testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_1000_events_to_the_writer_and_flush_it" classname="" time="0.012"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_5000_events_to_the_writer_and_flush_it" classname="" time="0.099"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_10000_events_to_the_writer_and_flush_it" classname="" time="0.185"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_20000_events_to_the_writer_and_flush_it" classname="" time="0.368"></testcase>
		<system-out><![CDATA[CGO_ENABLED is not 0. Compiling with -linkmode=external
goos: linux
goarch: amd64
pkg: github.com/stackrox/rox/central/administration/events/datastore
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
]]></system-out>
	</testsuite>
</testsuites>

Expect

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="4" errors="0">
	<testsuite name="" tests="4" failures="0" errors="0" id="0" time="0.664" timestamp="2023-10-26T18:51:22+02:00">
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_1000_events_to_the_writer_and_flush_it" classname="" time="0.012"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_5000_events_to_the_writer_and_flush_it" classname="" time="0.099"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_10000_events_to_the_writer_and_flush_it" classname="" time="0.185"></testcase>
		<testcase name="BenchmarkDatastore_Add_and_Flush/add_20000_events_to_the_writer_and_flush_it" classname="" time="0.368"></testcase>
		<system-out><![CDATA[CGO_ENABLED is not 0. Compiling with -linkmode=external
goos: linux
goarch: amd64
pkg: github.com/stackrox/rox/central/administration/events/datastore
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
]]></system-out>
	</testsuite>
</testsuites>
@stxml
Copy link

stxml commented May 8, 2024

I've encountered the same problem, and it seems to be caused by running a bench test with subtests and the -v flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants