summaryrefslogtreecommitdiffstats
path: root/tests/integration/run-docker.sh
AgeCommit message (Collapse)Author
2024-06-21fix: Shows an error msg when missing argsskalidindi53
Signed-off-by: skalidindi53 <s.teja2004@gmail.com>
2024-04-26chore: Add copyrights in some filesJoas Schilling
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-09-30Update default Docker images in integration tests helper scriptDaniel Calviño Sánchez
The updated images match those used in CI. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2022-09-30Add "--database-custom-command" option to Docker helper scriptDaniel Calviño Sánchez
This makes possible to launch the database used in the integration tests with a set of custom commands, for example, to replicate those used in CI. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2022-02-14Update image in script to run local integration tests in DockerDaniel Calviño Sánchez
PHP 7.3 support was dropped for Nextcloud 24. The Docker image is updated to the same image used for integration tests in CI. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-12-06Bump default Docker image used in helper script to run integration testsDaniel Calviño Sánchez
Support for PHP 7.1 was dropped in server. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-04-05Ignore node modules when running integration tests in DockerDaniel Calviño Sánchez
Node modules can take a lot of space, causing the copy of the local Git working directory of Nextcloud to the container to be slow. However, they are not needed when running the integration tests, so now they are excluded from the copy. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-04-05Reformat command callDaniel Calviño Sánchez
This improves its readability and makes possible to add new parameters more cleanly. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-12-10Fix "run-docker.sh" with PostgreSQL 10.5Daniel Calviño Sánchez
In the original "fix" (spoiler alert: the fix was wrong) "POSTGRES_DB" ended being empty due to "$DATABASE_NAME_dummy" being parsed as a full variable name, instead of "$DATABASE_NAME" followed by the string "_dummy". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-09-21Fix integration tests with Docker image for PostgreSQL 10.5Daniel Calviño Sánchez
The `postgres:10` tag is not fixed, but updated every time a new `postgres:10.X` image is released. Thus, the integration tests run in Drone always use the latest Docker image for PostgreSQL 10. The parameters used for the Docker container of PostgreSQL relied on a bug in both the Nextcloud installer and in the Docker image for PostgreSQL; the bug in the image was fixed in "postgres:10.5", so the tests started to fail due to not being able to install Nextcloud. The database user created in the image did not have "create role" privileges, so that user was the one used by the Nextcloud installer. After the fix it does, so the Nextcloud installer creates and uses a new user instead. However, if an existing database name is given to the installer the installer does not grant privileges to that new user on the existing database. By default the container creates a new database with the same name as the database user ("oc_autotest"), and that database was passed to the installer. Thus, as the new user was not granted privileges on the existing database it could not connect to it and the installation failed. Now the container creates a dummy database with a different name to the one passed to the installer, so now the "oc_autotest" database is created by the installer and the new user is made owner of that new database. Note that this fix is backwards compatible with PostgreSQL images prior to the fix, so no special handling is needed in `run-docker.sh` when older images are used. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-09-14Make possible to run Docker integration tests on PostgreSQLDaniel Calviño Sánchez
Now it is possible to use PostgreSQL as the database when running the integration tests on Docker by calling "run-docker.sh" with the "--database pgsql" option. It is not possible to wait for the PostgreSQL server to be ready using curl like it was done for MySQL; when sending a HTTP request to the PostgreSQL port the server sends an empty response, which curl sees as an error. However, as Bash supports testing a connection with a remote TCP socket, and this approach is valid for both MySQL and PostgreSQL servers, the curl call was replaced with this Bash construct. The default PostgreSQL database image is "postgres:10", the same currently used when running the tests on Drone; a different one can be specified with the "--database-image IMAGE_NAME" option. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-09-14Make possible to run Docker integration tests on MySQLDaniel Calviño Sánchez
Now it is possible to use MySQL as the database when running the integration tests on Docker by calling "run-docker.sh" with the "--database mysql" option. This will launch the database server in its own Docker container, connect it with the container in which Nextcloud is run, and set the database as the one to be used by Nextcloud. If "--database XXX" is not specified then SQLite is used; in that case everything behaves as before (no database server is started). The default MySQL database image is "mysql:5.7", the same currently used when running the tests on Drone; a different one can be specified with the "--database-image IMAGE_NAME" option. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-09-21Add helper script to run integration tests on a Docker containerDaniel Calviño Sánchez
When running the integration tests through "run.sh" the parent directory of the Spreed application must be the "apps" directory of an installed Nextcloud server. Running the tests modifies the configuration and database of that server, and the tests could fail too if the state of its database conflicts with that expected by the tests. The new "run-docker.sh" is a wrapper around "run.sh" that copies the code (but not the configuration or data) of the Nextcloud server and its applications to a Docker container, installs the Nextcloud server inside the container (with a SQLite database), and then executes the integration tests on the fresh server. This prevents the integration tests from messing with the original Nextcloud server, and also ensures that the integration tests will be run with a known initial state. Besides that, when calling "run-docker.sh" the Docker image to be used can be specified, so the tests can be easily run on PHP 5.6 or PHP 7.1 using "run-docker.sh --image nextcloudci/phpX.Y:phpX.Y-Z". If the "--image" option is not given by default the image "nextcloudci/php7.1:php7.1-15" will be used. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>