Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cppinttest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cppinttest
Commits
2de49a5c
Commit
2de49a5c
authored
5 months ago
by
Joscha Schmiedt
Browse files
Options
Downloads
Patches
Plain Diff
Add check if CAOSDB_SERVER_CERT was set
parent
ad7f2d22
Branches
Branches containing commit
No related tags found
2 merge requests
!41
Release 0.3.0
,
!39
Add test for connection error if certificate is not valid
Pipeline
#57527
passed
5 months ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_connection.cpp
+6
-2
6 additions, 2 deletions
test/test_connection.cpp
with
6 additions
and
2 deletions
test/test_connection.cpp
+
6
−
2
View file @
2de49a5c
...
...
@@ -78,6 +78,7 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) {
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
const
auto
path
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
EXPECT_FALSE
(
path
.
empty
())
<<
"CAOSDB_SERVER_CERT must be set to run this test."
;
auto
cert
=
PemFileCertificateProvider
(
path
);
auto
config
=
TlsConnectionConfiguration
(
host
,
port
,
cert
);
...
...
@@ -95,6 +96,8 @@ TEST(test_connection, connection_ssl_authentication_error_wrong_credentials) {
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
const
auto
path
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
EXPECT_FALSE
(
path
.
empty
())
<<
"CAOSDB_SERVER_CERT must be set to run this test."
;
const
auto
*
const
user
=
"not-a-user-23461237"
;
const
auto
*
const
password
=
"very-c-cred"
;
...
...
@@ -115,6 +118,8 @@ TEST(test_connection, connection_ssl_authentication_error_wrong_certificate) {
auto
port
=
std
::
stoi
(
port_str
);
const
auto
*
const
host
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_HOST"
,
"localhost"
);
const
auto
path
=
linkahead
::
utility
::
get_env_fallback
(
"CAOSDB_SERVER_CERT"
,
std
::
string
());
EXPECT_FALSE
(
path
.
empty
())
<<
"CAOSDB_SERVER_CERT must be set to run this test."
;
// TODO (JTS): This is a hack. We should use the credentials in the linkahead-client.json
const
auto
*
const
user
=
"admin"
;
...
...
@@ -150,12 +155,11 @@ X+F/0oljKZKJ2SswKDLztD0CY3VZhdDHfWlfIls1ttax4eEN1HgMtTyZ0JYdr9Iy
Dbc8hkR8vIDcwFu31jiHx/BWmv+pjzx4F2qX7tgTG8wM3WHJwqzgrA1IeLliQpo6
yVMsKq9927ZJXZbL/ewiA1Mm6IBe+SpJ8IafmUk=
-----END CERTIFICATE-----)"
);
auto
bad_config
=
TlsConnectionConfiguration
(
host
,
port
,
bad_cert
,
auth
);
auto
bad_connection
=
Connection
(
bad_config
);
auto
bad_status
=
bad_connection
.
RetrieveVersionInfoNoExceptions
();
EXPECT_EQ
(
bad_status
.
GetCode
(),
StatusCode
::
CONNECTION_ERROR
);
}
TEST
(
test_connection
,
connection_ssl_authentication_success
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment