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

Customize or reduce assertion errors description #214

Open
MelleD opened this issue Dec 14, 2023 · 7 comments
Open

Customize or reduce assertion errors description #214

MelleD opened this issue Dec 14, 2023 · 7 comments
Labels
❔ question Further information is requested

Comments

@MelleD
Copy link

MelleD commented Dec 14, 2023

I would like to customize or reduce the error messages.

With batch operations, the output when an error occurs is far too large and confusing with the entire SQL in it. It also makes the tests much slower.

For example, this appears 100 times in the log and in the test case and clutters up the log.

Time:8, Success:True, Type:Prepared, Batch:True, QuerySize:1, BatchSize:100, Query:["update [http_endpoint] set [http_endpoint].[model_reference] = ?, [http_endpoint].[last_modified_by] = ?, [http_endpoint].[last_modified_at] = ? where [http_endpoint].[aspect_id] = ?"], Params:[(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT)),(foo,bar,1702550385629,NULL(BIGINT))]

@MelleD MelleD added the ❔ question Further information is requested label Dec 14, 2023
@jeanbisutti
Copy link
Collaborator

@MelleD You can use -DlimitQuickPerfSqlInfoOnConsole=true to limit the console verbosity (thanks @kanedafromparis for having implemented this!). It will apply to all the tests. To limit the console verbosity to only one test, you can use the property with the JvmOptions annotation applied to the test method.

Perhaps the best option for JDBC batches with an unreduced data set is to only use the ExpectJdbcBatching annotation.

Does this help you?

@MelleD
Copy link
Author

MelleD commented Dec 18, 2023

@jeanbisutti

At first I didn't see any difference. I'll set it to the base class so that it's for all tests.
Are the options described somewhere?

@JvmOptions( "-DlimitQuickPerfSqlInfoOnConsole=true" )
and for spring
JvmAnnotationBuilder.jvmOptions( "limitQuickPerfSqlInfoOnConsole=true" )

Tried both with -D and without.

Maybe here is the issue, the property is not in the System.getProperty

   public static final SystemProperty<Boolean> SIMPLIFIED_SQL_DISPLAY =
            new SystemProperty<Boolean>() {

                private final String name = "limitQuickPerfSqlInfoOnConsole";

                @Override
                public Boolean evaluate() {
                    String booleanAsString = System.getProperty(name);
                    return Boolean.valueOf(booleanAsString);
                }

                @Override
                public String buildForJvm(String propertyValue) {
                    return "-D" + name + "=" + propertyValue;
                }
            };

@jeanbisutti
Copy link
Collaborator

@MelleD Sorry, it can't work with JvmOption (a JVM property annotation should be added to QuickPerf).

You could set the property from your build tool (see Surfire with Maven).

You could also programmatically use System.setProperty("limitQuickPerfSqlInfoOnConsole", true) / System.setProperty("limitQuickPerfSqlInfoOnConsole", false) .

With batch operations, you could also only use the ExpectJdbcBatching annotation.

@MelleD
Copy link
Author

MelleD commented Dec 18, 2023

You could also programmatically use System.setProperty("limitQuickPerfSqlInfoOnConsole", true) / System.setProperty("limitQuickPerfSqlInfoOnConsole", false) .

Yes that's clear, but not really recommended in Spring (tests) :)
Normally you use the properties/yaml file, the TestSourceProperty or in SpringBootTest the properties key.

Sorry, it can't work with JvmOption (a JVM property annotation should be added to QuickPerf).

Do you think it is possible to extend that we can use JvmOption here?

For me I would use this in my QuickPerfConfig JvmAnnotationBuilder.jvmOptions( "limitQuickPerfSqlInfoOnConsole=true" )
or also good a spring boot properties in application-test.properties or yaml

You could set the property from your build tool (see Surfire with Maven)

That's clear but I would avoid this, also not so nice for local development to set always the property

@jeanbisutti
Copy link
Collaborator

Do you think it is possible to extend that we can use JvmOption here?

A JvmSystemPropertry annotation should be added. I can help you to do it and contribute if you are interested.

You are using Spring. So, you could try to set the property from Spring, for example: @SpringBootTest(properties = { "limitQuickPerfSqlInfoOnConsole=true" }).

That's clear but I would avoid this, also not so nice for local development to set always the property

You could enable the property from Surfire. And for local development, investigation, use @DisplaySqlQuery.

@MelleD
Copy link
Author

MelleD commented Dec 19, 2023

A JvmSystemPropertry annotation should be added. I can help you to do it and contribute if you are interested.

That sounds awesome

You are using Spring. So, you could try to set the property from Spring, for example: @SpringBootTest(properties = { "limitQuickPerfSqlInfoOnConsole=true" }).

This was my preferred way also tried the properties file. But both did not work.

@jeanbisutti
Copy link
Collaborator

@MelleD Another possibility would be to be provide a way to configure some annotations with a short error display (configuration at annotation level). It will avoid the creation of a new JVM. What do you prefer? I can help you to contribute in both cases if you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants