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

Assert the actually used backend and context implementations in tests modules #57

Open
yevhenii-nadtochii opened this issue Sep 22, 2023 · 0 comments

Comments

@yevhenii-nadtochii
Copy link
Collaborator

yevhenii-nadtochii commented Sep 22, 2023

These modules test LogLevelMap in different combinations of backend and context.

A particular pair of backend and context implementations is a test subject here. But we can't specify them with code. They are part of Gradle module configuration. We add the corresponding implementations to runtimClasspath and make the assumption that the logging Platform would load exactly them. And I believe it is so in most cases.

Though, recently in #50 it was found that if two following conditions are met:

  1. Backend implementation fails to expose its BackendFactory as a Java service. It may be due to incorrect service declaration in META-INF file. Or maybe the annotation preprocessor didn't start (if @AutoValue annotation was used).
  2. Some transitive dependency puts another BackendFactory on the classpath.

Then our test may accidentally pass where it should have failed.

I've added such assertions in the following tests:

  • jvm-our-backend-our-context.
  • jvm-log4j-backend-our-context.

Please take a look and propagate such assertions to other modules in tests directory. It is sort of double check, but it may be useful due to complexity of Gradle configurations and runtime.

Maybe some abstract base can be created for such assertions.

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

1 participant