diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 7447d487dd6ee93ceb6e9ca4fa860da5c341d20e..9f678911da9c407086b86c659313cb8fdf4fbb64 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 0000000000000000000000000000000000000000..c40605a12e8426aa3d6c7b54d97a951b3640e033 --- /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 6f003b3f3d028b84fb7e16213822cecbcbdc4a2c..67890f8fec927cc3fc71e628f249f7185a49c88a 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 1000198a0834b85a9a7eb129a3d08463f5a56e63..be0861b416b0c0114673b657af2ea698e727885e 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 34c8700130df950d1dab9c1bbc3943edba288af5..60a4f2839520b1e5546e34eb8b2cb6df6e991f0e 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 61a23b18bb951ec0e5eda31f98d96f8de9dc53f9..c1294a923f20287e6b92d24edae2f09882281c52 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