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

Start of adding XSuite tests to Maven for XQSuite #291

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adamretter
Copy link
Member

DO NOT MERGE YET.

I made a start on having the XQSuite tests execute via XSuite with Maven.

There is a problem where XSuite is run outside of eXist-db, and an XQuery module imports another module, the resolution of the module fails. Unfortunately there is not a quick solution to this. XSuite assumes that all dependencies are available in eXist-db, but eXist-db does not know where to find the dependencies.

There are a number of options I can think of here:

  1. When we start eXist-db from Maven for testing, we could autodeploy a copy of the built XAR. Actually we also need to deploy other Xars on which our Xar depends too, e.g. shared-resources, templating, etc...
  2. For testing, we use the Maven resources plugin to rewrite the "at" declarations in our XQuery modules to point to the real location of the modules on the filesystem.
  3. When we start eXist-db for testing, we tell it to use a custom URI Resolver for module lookups, which is Maven project aware.

Either way, it will take some time to write some Java code and test it.

My preference would likely be (1). This could be done either by:

  1. Adding options to conf.xml which specify Xars which should be autodeployed at startup if they are not already available.
  2. Developing an eXist-db plugin for Maven.

@adamretter
Copy link
Member Author

There is also a bug in eXist-db's SourceFactory.java which compounds this problem. Fixing that might be enough for simple XQSuite tests to run via XSuite.

@duncdrum
Copy link
Contributor

duncdrum commented Jan 3, 2019

phew i know that @dizzzz has already done work in that area, so he might have some ideas.

Looking at the mavenization of the docs in general i have a two feature wishes though.

  • XQSuite tests should be executable during development from inside a running instance. Users shouldn't have to rebuild and reinstall the whole project every time they add a single %test:arg. This means that tests need to be accessible from /modules/ inside the deployed .xar
  • XQSuite test should run with the equivalent of both :latest and :release to get a heads-up with respect to upcoming changes.

This leads me to think that we could,

  • We could have a maven aware XQSuite test-runner at src/test/xquery/${project.name}/other-runner.xql which handles the imports differently and gets filtered and copied into modules, i.e. 3.
  • We could try using something along docker maven plugin lines to use docker images from inside maven (this would also make integration testing easier) , i.e. alternative to 1.

We could also adopt a similar approach to what I did with yeoman. If my local mocha can access the apps inside a running exist instance it executes the XQSuite tests, if it gets a 200 the XQSuite tests are skipped (but not failed). So mvn test will try to talk to a local exist and if it isn't there skip the XQSuite tests. This plays well with CI and local development workflows. Since we already have mocha we could just reuse the code for this from the generator.

The copy a conf.xml approach seems inelegant, expath-pkg.xml should suffice for xapth dependencies, what happens if i put duncans-new.xar in there, but don't declare it in the former? What happens between different version of exist with modified conf.xml?

an exist-db plugin seems more suited, and future-proof overall.

@duncdrum duncdrum added this to the 4.0.5 milestone Jan 3, 2019
@duncdrum duncdrum modified the milestones: 4.1.0, 4.1.1 Jan 24, 2019
@duncdrum duncdrum modified the milestones: 4.1.1, 4.1.2 Mar 1, 2019
@duncdrum duncdrum modified the milestones: 4.1.2, 4.1.3 Mar 12, 2019
@duncdrum
Copy link
Contributor

see #333
see eXist-db/exist#2657

This was referenced May 14, 2019
@duncdrum duncdrum modified the milestones: 4.1.3, 4.2.1, 5.0.0 May 23, 2019
Copy link
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point of caution exist-testkit is not available since 4.7.0

@duncdrum duncdrum modified the milestones: 5.0.0, 5.2.0 Jan 29, 2020
@dizzzz dizzzz marked this pull request as draft October 17, 2020 17:56
@line-o line-o removed this from the 5.2.0 milestone Nov 25, 2021
@line-o
Copy link
Member

line-o commented Feb 11, 2022

Is this PR being worked on in the future or should we rather close it?

@adamretter adamretter force-pushed the xsuite branch 3 times, most recently from 85a2251 to d5c9715 Compare January 3, 2023 21:45
@adamretter adamretter force-pushed the xsuite branch 2 times, most recently from 176b0e3 to ca2ad67 Compare January 3, 2023 22:47
@adamretter
Copy link
Member Author

@line-o Yes, it just requires a newer version of eXist-db first, and then some refactoring of the tests.

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.

3 participants