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

Payara-4176 TestContainers+Arquillian+JUnit5 Prototype #4263

Closed
wants to merge 56 commits into from
Closed

Payara-4176 TestContainers+Arquillian+JUnit5 Prototype #4263

wants to merge 56 commits into from

Conversation

dmatej
Copy link
Contributor

@dmatej dmatej commented Oct 8, 2019

Prototype of tests with the usage of TestContainers, Arquillian and JUnit5

Status

STILL IN PROGRESS!

  • remote tests OK
  • in container tests - injections does not work
  • DockerNodesITest - "docker in docker"
    • management of docker payara instances
  • DatabaseITest
    • real database server and real payara server
    • incomplete, will be refactored
  • CertificateRealmITest
    • complete
    • note that we don't need Arquillian, we can deploy the physical application using asadmin commands or client, and find the url using it too. But this is simplier.
  • VerboseLoggingITest
    • server hangs with full logging (known issue, czclic dependency with HK2)
  • JtaTimeoutLoggingITest
    • tests logging of the Payara Server DAS, asynchronous
git  checkout PAYARA-4176-TestContainers-prototype
mvn clean install -PQuickBuild -DskipTests=true 
mvn clean verify -Ptest-containers  -pl :test-containers
  • compiles Payara fastest as possible, skips broken tests
  • runs tests; first run is slow, downloads docker image to cache. Next run takes around minute.

Dependencies

https://github.com/dmatej/arquillian-junit5-extension (fixed master) (local mvn clean install required)
https://github.com/zforgo/arquillian-junit5-extension (original master)

See Also

arquillian/arquillian-core#137

@dmatej dmatej requested a review from rdebusscher October 8, 2019 14:02
@dmatej dmatej self-assigned this Oct 8, 2019
@dmatej dmatej requested a review from OndroMih October 10, 2019 07:20
@dmatej dmatej changed the title Payara-4176 TestContainers Prototype Payara-4176 TestContainers+Arquillian+JUnit5 Prototype Oct 17, 2019
David Matejcek added 21 commits March 21, 2020 20:52
- removed "random" settings of psSelected/winPsSelected
- removed configuration of psSelect from convertNodePswd
- created presetNodeAuthSelectBox
- enabled autocomplete, without it was configuration hostile except password,
  which were still remembered by Firefox
- fixed nodeButtons.inc - password/keystore gui
- fixed UpdateNodeCommand
  - password/keystore gui, old version used previous version
  - reimplemented validation
- renamed PARAM_REMOTEPASSWORD to PARAM_SSHPASSWORD
- ParameterMap - implemented additional methods for better readibility
- report classes have toString now (useful for debugging and logging)
- GuiUtil - reduced copy and paste and using sane filtering
- RestUtil2 + RestApiHandlers
  - fixed processing error messages using new method in GuiUtil
  - expecting JSON, but it will not fail if the response would be unparseable,
    it would only print error to log.
- added profile FullBuild as the opposite to QuickBuild
- added profile manual for manual testing
  - runs payara server on some mapped local port
  - mvn clean verify -Ptest-containers,manual -pl :test-containers
  - can be interrupted by CTRL+C
  - see target/payara5
- supported docker bases - ubuntu and debian, centos would need more work yet
- parts may be moved to test-tools later and can be combined with arquillian
- requirement: docker installed
…ara.version

- so it is possible to run Payara of different version than I have
  checked out from the GIT.
…test!

- arquillian-junit5 dependency
  - brings JUnit5+Arquillian integration
  - WARN: dependency on locally built package!
- moved to failsafe, no unit tests here
- PayaraDockerArquillianExtension
  - does not need and does not support any configuration, uses DockerEnvironment
- PayaraDockerDeployableContainer
  - Arquillian extension to support deploy into the docker container
- PayaraServerContainer
  - added useful getters returning basic endpoint URLs
- PayaraServerFiles
  - simplified local access to domain files
- KeyStoreManager
  - wrapper of KeyStore with much nicer API
- CertificateRealmITest
  - base for the test for PAYARA-3793
- tested in Eclipse - still does not work because of known problems with
  locating resources (that is the purpose of fixEclipseJars.sh, but here
  it is more complicated, because we would need repack all jars in zip
  containing resource bundles
- added rm -rf and unzip is done inside container
- initSslLogging did not work when executed from the test code, use cmd line
- reconfigured test logging
- fixed JUL to SLF4j bridge configuration
- reconfigured logging on the test side
- CertificateRealmITest enhanced test
…name

- this set of tests found also a bug in realms, so they don't pass now,
  because the reset() method is not able to reset realm until instance
  is restarted
- now you can read it like a book ;)
- note yields - all threads and processes are not synchronized, so this is
  softest possible thing to flush all logs before the next test.
- older versions of payara have broken deployment-client even with another groupId
- this dependency also is not released to external maven repositories
- two extension declared on same class
- order of methods in order of execution
- no need to DockerITest here, bit of a cleanup before another test
… database

- database schema not created yet, to be done
- note: this is messy commit before cleanup!!!
- support for JDK11 (and JDK8 if it is supported also by the OS)
- asadmin output available to tests
- reliable detection of in-container network ip address, no russian roulette
- docker execution inside docker container
  - to be removed, depends on docker service on mapped host port
  - docker must be reconfigured to allow such connections from another network (!)
  - in effect it is the same docker as on host, so why not executing it directly?
  - NO! That's why we already have TestContainers, so use it!!!
  - current implementation has problems: does not remove containers and networks
    after execution. Each run creates persistent container and network.
  - (this pseudodiscussion is here only to name all possibilities and their disadvantages)
- TempNodesITests
  - first version, will be changed to use standard GenericContainer even for
    the temp node
  - see previous statement to understand problems with this
  - it is able to test creation and registration of the temp node!
- junit4 removed from mandatory dependencies of all modules
- junit4 now must be declared only where it is used
- junit4, testng, jmockit - default scope is the test scope
- bit of formatting (removed tabs from poms)
- easymock upgraded from 3.0 to 4.0.2
- maven-jar-plugin upgraded to 3.1.2 (does not change anything)
- tests DAS administered nodes and instances
- good bye, Java EE!
- welcome, Jakarta EE!
- EventCollectorAppender
  - uses special LOG4J's log appender collecting filtered log lines
- WaitForExecutable
  - repeatedly runs executable until it succeeds or times out
- JtaTimeoutLoggingITest
  - checks selected server.log warnings
  - would need changes if the server.log would change it's format - that's correct :)
David Matejcek added 27 commits March 21, 2020 20:52
- broken and hacked to work at least partially many years ago
  - formatter used message to hold two values - key and the message, then it split
    the message into two values.
  - now EnhancedLogRecord has explicit field for that, no substring magic
    needed (ODLLogFormatter)
- BooleanLatch was replaced by AtomicBoolean and deleted
- records which are not loggable from the viewpoint of handler are not processed at all
- SysLog, SyslogHandler - formatting, imports, atomic
- UniformLogFormatter
  - removed redundant cache with worse performance and behavior than JDK
- using startupQueue instead of EarlyLogHandler
- added FIXME - atomic configuration required to fix issue with race conditions
  depending on the order of setter calls
- these problems were here for years and this cannot fix them, it only "magically"
  stabilizes the logging system
- Task, LogRotationTimer and PayaraNotificationLogRotationTimer deleted
- LogFileRotationImplementation created
- LogRotationTimer is abstract
- LogRotationTimerTask - new abstract class, children specify time management
- UniformLogFormatter - fixed mistake in recent commit (exception)
- added unit test
- GFFileHandler
  - rotationRequested removed, it was not used
  - used api is still allows disabling enabled rotation variant when not asked,
    it depends on order of method calls.
- faster, no need of synchronized blocks
- note: it is not possible to replace millis with Instant or Zoned* or Local*,
  JUL does not support it. It would be possible only to extend the LogRecord,
  but then we would duplicate information.
- MeteredStream - moved to own file
- LoggingPump - not anonymous any more, can have fields etc.
…, null message possible

- EnhancedLogRecord
  - methods to get OffsetDateTime and print stack trace
- FormatterDelegate
  - added javadoc
- MessageResolver, GFFileHandler, ODLLogFormatter, UniformLogFormatter, JSONLogFormatter
  - extracted and improved copypasted code
- ODLLogFormatter
  - code cleanup
- SyslogHandler
  - trivial cleanup
- UniformLogFormatter
  - code cleanup
- AgentFormatterDelegate
  - only imports, should be visited again; has dependency cycle
- we don't need to see the server.log content, we need only to reliably restart
  the domain and watch the server.log file - test should not end before all
  buffers would be flushed to the file
- LOG_END constant accepts log endings for ODL+Uniform log formatters
- payara-jul-extensions
- separated HK2 management of logging system and logging system classes
- early initialization without HK2 and OSGi
- own PayaraLogManager and other classes
- some failing tests ignored for 10 years deleted
- fixed dependencies and initialization of logging system in tests
- covered scenario without using initializer
- surefire now does not trim stacktraces - too often the only way to understand
  what is wrong
- log manager is configurable for tests (PayaraLogManager is not mandatory)
- created enum SshAuthType (KEY/PASSWORD) to distinguish which variant should
  be saved if we don't set neither password nor keyfile
- new parameter sshauthtype to allow switching with defaults
- created enum SshAuthType (KEY/PASSWORD) to distinguish which variant should
  be saved if we don't set neither password nor keyfile
- new parameter sshauthtype to allow switching with defaults
…yara Micro

- tested with Micro Docker image test
- seems that when we are updating sshauth element, setSshConnector must be
  already called
@dmatej dmatej closed this Mar 24, 2020
@dmatej
Copy link
Contributor Author

dmatej commented Mar 24, 2020

I'm closing this PR, but not the branch. The branch is and will be used as an incubator for other issues, and in some future it will split into standalone pull requests.

Also TestContainers usage will be refactored, because with new docker images it can build tests on them, not on own (expensive) image.

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

Successfully merging this pull request may close these issues.

2 participants