Run local acceptence tests with local backend add-on (plone.restapi)

How do I start an acceptence test backend with docker with local plone.restapi?

Starting with Volto make command

######### Core Acceptance tests

.PHONY: start-test-acceptance-server test-acceptance-server

start-test-acceptance-server test-acceptance-server: ## Start Test Acceptance Server Main Fixture (docker container)

docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e ADDONS='$(KGS) $(TESTING_ADDONS)' -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors $(DOCKER_IMAGE) ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING

I added the to be developed add-on:

docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e DEVELOP="/Users/katjasuss/Volto/sandbox/backend/src/plone.restapi/" -e ADDONS='plone.volto==4.0.0a4 plone.rest==2.0.0a5 plone.app.iterate==4.0.2 plone.app.robotframework==2.0.0a6 plone.app.testing==7.0.0a3' -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors plone/plone-backend:5.2.7 ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING

seems to lack some parameter(s)

The log says:

Installing DEVELOPment addons /Users/katjasuss/Volto/sandbox/backend/src/plone.restapi/
THIS IS NOT MEANT TO BE USED IN PRODUCTION
Read about it: GitHub - plone/plone-backend: Plone backend Docker images using Python 3 and pip.
=======================================================================================
ERROR: /Users/katjasuss/Volto/sandbox/backend/src/plone.restapi/ is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

If I replace
DEVELOP="/Users/katjasuss/Volto/sandbox/backend/src/plone.restapi/"
with
DEVELOP="git+https://github.com/plone/plone.restapi.git@users-endpoint-search-fullname#egg=plone.restapi"
the branch is pulled in from Github, which is fine and what is to be expected.
So just one step more to get it from local…

I don't have experience with the new plone-backend docker image, but:

I typically use a docker-compose.yml file, it makes it easier to keep track of that huge docker command line.

Your equivalent docker-compose.yml file would be:

version: "3"
services:
    plone:
        image: plone/plone-backend:5.2.7
        environment:
            ZSERVER_HOST: "0.0.0.0"
            ZSERVER_PORT: "55001"
            APPLY_PROFILES: "plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage"
            ADDONS: "plone.volto==4.0.0a4 plone.rest==2.0.0a5 plone.app.iterate==4.0.2 plone.app.robotframework==2.0.0a6 plone.app.testing==7.0.0a3"
            CONFIGURE_PACKAGES: "plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors"
            DEVELOP: "git+https://github.com/plone/plone.restapi.git@users-endpoint-search-fullname#egg=plone.restapi"
        ports:
            - "55001:55001" 
        command: bash

Basically I want the container to be a very dumb vessel and act like a virtual machine. If the bash command doesn't work, you can overwrite the entrypoint with:

entrypoint: sh -c "tail -f /dev/null"

With that, I can do things like:

docker compose exec plone ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING

or

docker compose exec plone bash

and have a "virtual machine" up and running, where I can inspect the contents of that container. This way you can figure out the location of the container's develop folder, so then you can map it like:

services:
    plone:
         ...
         volumes:
              - ./src/plone.restapi:/path/in/container/to/plone.restapi
2 Likes

I'm starting to like docker. Thank you @tiberiuichim, that are great tips.

I map the develop folder instead of the subfolder with the checkout of the add-on, cause otherwise docker complains that the directory already exists. So this is how it works for me:

services:
    plone:
         ...
         volumes:
              - ./src/:/app/src/

Merci!

1 Like

Plone Foundation Code of Conduct