From 4e9ca73283ca9e363dfa0e546d4f05813c9a7997 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Mon, 2 Aug 2021 13:51:40 +0000 Subject: [PATCH] ENH: Add tests for minimal functionality --- .docker/Dockerfile | 2 ++ .docker/caosdb_client.json | 28 ++++++++++++++++++++++++++++ .docker/tester.yml | 1 + CHANGELOG.md | 1 + README_SETUP.md | 9 +++++++-- test/runtests.jl | 13 +++++++++++-- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 .docker/caosdb_client.json diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 7447d48..9f67891 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -17,6 +17,8 @@ RUN ./install_cpplib.sh COPY . /caosdb-juliainttest WORKDIR /caosdb-juliainttest +COPY .docker/caosdb_client.json /caosdb_client.json + # Set-up and run the integration test CMD export LD_LIBRARY_PATH=/root/.local/lib:$LD_LIBRARY_PATH && \ echo "F_BRANCH = $F_BRANCH" && \ diff --git a/.docker/caosdb_client.json b/.docker/caosdb_client.json new file mode 100644 index 0000000..c40605a --- /dev/null +++ b/.docker/caosdb_client.json @@ -0,0 +1,28 @@ +{ + "connections": { + "default": "julialib-integrationtest", + "julialib-integrationtest": { + "host": "caosdb-server", + "port": 8443, + "server_certificate_path": "/cert/caosdb.cert.pem", + "authentication": { + "type": "plain", + "username": "admin", + "password": "caosdb" + } + }, + "local-caosdb": { + "host": "localhost", + "port": 8443, + "server_certificate_path": "some/path/cacert.pem", + "authentication": { + "type": "plain", + "username": "me", + "password": "secret!" + } + } + }, + "extension": { + "this is my": "special option" + } +} diff --git a/.docker/tester.yml b/.docker/tester.yml index 6f003b3..67890f8 100644 --- a/.docker/tester.yml +++ b/.docker/tester.yml @@ -5,6 +5,7 @@ services: environment: CAOSDB_SERVER_HOST: caosdb-server CAOSDB_SERVER_CERT: /cert/caosdb.cert.pem + CAOSDB_CLIENT_CONFIGURATION: /caosdb_client.json F_BRANCH: $F_BRANCH networks: - docker_caosnet diff --git a/CHANGELOG.md b/CHANGELOG.md index 1000198..be0861b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Basic CI infrastructure * Simple test for the connection to a CaosDB server +* Tests for connecting via config files ### Changed diff --git a/README_SETUP.md b/README_SETUP.md index 34c8700..60a4f28 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -7,10 +7,15 @@ environmental variable in such a way that a connection can be established with C ```julia using CaosDB -CaosDB.Connection.connect() +CaosDB.Connection.connect_manually() ``` -i.e., without any explicit arguments to the call to `connect`. +i.e., without any explicit arguments to the call to +`connect_manually`. Also set up a `caosdb_client.json` either in with +a connection named `julialib-integrationtest` as default that connects +to the above server. See the [documentation of +libcaosdb](https://docs.indiscale.com/caosdb-cpplib/) for more +information on the config file. # Tests diff --git a/test/runtests.jl b/test/runtests.jl index 61a23b1..c1294a9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -55,5 +55,14 @@ catch e end end -# test whether connection can be established without an error -@test CaosDB.Connection.connect() != nothing +@testset "Test CaosDB" begin + + @testset "Test connection" begin + # test whether connection can be established without an error + @test CaosDB.Connection.connect() != nothing + @test CaosDB.Connection.connect("julialib-integrationtest") != nothing + # Test manually + @test CaosDB.Connection.connect_manually() != nothing + end + +end -- GitLab