Skip to content

Commit c8bddd8

Browse files
committed
test: add integration tests for certificate engine switching
Add Behat integration tests to validate engine switch detection. Tests verify that switching between OpenSSL and CFSSL certificate engines without proper configuration is correctly detected and reported. Scenarios tested: - Set OpenSSL engine, configure it, then switch to unconfigured CFSSL - Delete engine configuration and verify error state Fixes #5272 Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 797d15a commit c8bddd8

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Feature: admin/certificate_engine_switch
2+
Background:
3+
Given as user "admin"
4+
5+
Scenario: Set engine to OpenSSL, configure it, then switch engine and verify
6+
# Define engine as OpenSSL
7+
When sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/certificate_engine"
8+
| value | openssl |
9+
Then the response should have a status code 200
10+
# Configure OpenSSL
11+
When sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
12+
| rootCert | {"commonName":"OpenSSL Root CA"} |
13+
Then the response should have a status code 200
14+
# Verify OpenSSL is configured correctly
15+
And sending "get" to ocs "/apps/libresign/api/v1/admin/configure-check"
16+
Then the response should have a status code 200
17+
And the response should be a JSON array with the following mandatory values
18+
| key | value |
19+
| (jq).ocs.data\|map(select(.resource=="openssl-configure"))[0].status | success |
20+
# Switch to CFSSL engine without configuring it
21+
When sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/certificate_engine"
22+
| value | cfssl |
23+
Then the response should have a status code 200
24+
# Verify CFSSL shows error because it's not configured
25+
And sending "get" to ocs "/apps/libresign/api/v1/admin/configure-check"
26+
Then the response should have a status code 200
27+
And the response should be a JSON array with the following mandatory values
28+
| key | value |
29+
| (jq).ocs.data\|map(select(.resource=="cfssl-configure"))[0].status | error |
30+
| (jq).ocs.data\|map(select(.resource=="cfssl-configure"))[0].tip | Run occ libresign:configure:cfssl --help |
31+
32+
Scenario: Set engine to none and verify error state
33+
# Delete engine configuration (set to none)
34+
When sending "delete" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/certificate_engine"
35+
Then the response should have a status code 200
36+
# Verify configure-check shows error for default engine (OpenSSL)
37+
And sending "get" to ocs "/apps/libresign/api/v1/admin/configure-check"
38+
Then the response should have a status code 200
39+
And the response should be a JSON array with the following mandatory values
40+
| key | value |
41+
| (jq).ocs.data\|map(select(.resource=="openssl-configure"))[0].status | error |
42+
# Verify has-root-cert returns false
43+
And sending "get" to ocs "/apps/libresign/api/v1/setting/has-root-cert"
44+
Then the response should have a status code 200
45+
And the response should be a JSON array with the following mandatory values
46+
| key | value |
47+
| (jq).ocs.data.hasRootCert | false |

0 commit comments

Comments
 (0)