Skip to content

Commit

Permalink
Add e2e_tests to cover different configurations for serial_number and…
Browse files Browse the repository at this point in the history
… slot_number

Signed-off-by: Mohamed Omar Asaker <mohamed.omarasaker@arm.com>
  • Loading branch information
mohamedasaker-arm committed May 16, 2022
1 parent 72b07b2 commit ae0f507
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 3 deletions.
37 changes: 34 additions & 3 deletions e2e_tests/tests/all_providers/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,40 @@ fn no_user_pin() {
}

#[test]
fn no_slot_number() {
set_config("no_slot_number.toml");
// The service should still start, without the slot number.
fn no_serial_or_slot_number() {
set_config("no_serial_or_slot_number.toml");
// The service should still start, without the serial number or the slot number.
reload_service();

let mut client = TestClient::new();
let _ = client.ping().unwrap();
}

#[test]
fn slot_number_only() {
set_config("slot_number_only.toml");
// The service should still start, using the slot number only.
reload_service();

let mut client = TestClient::new();
let _ = client.ping().unwrap();
}

#[test]
fn serial_number_only() {
set_config("serial_number_only.toml");
// The service should still start, using the serial number only.
reload_service();

let mut client = TestClient::new();
let _ = client.ping().unwrap();
}

#[test]
fn slot_numbers_mismatch() {
set_config("slot_numbers_mismatch.toml");
// The service should still start, while the slot number that has
// the token of interest doesn't match the slot number in configuration.
reload_service();

let mut client = TestClient::new();
Expand Down
31 changes: 31 additions & 0 deletions e2e_tests/tests/all_providers/config/tomls/serial_number_only.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[core_settings]
# The CI already timestamps the logs
log_timestamp = false
log_error_details = true

# The container runs the Parsec service as root, so make sure we disable root
# checks.
allow_root = true

[listener]
listener_type = "DomainSocket"
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
# that the service does not hang for very big values of body or authentication length.
timeout = 3000 # in milliseconds
socket_path = "/tmp/parsec.sock"

[authenticator]
auth_type = "Direct"

[[key_manager]]
name = "sqlite-manager"
manager_type = "SQLite"
database_path = "./kim-mappings/sqlite/sqlite-key-info-manager.sqlite3"

[[provider]]
provider_type = "Pkcs11"
key_info_manager = "sqlite-manager"
library_path = "/usr/local/lib/softhsm/libsofthsm2.so"
user_pin = "123456"
# The serial number optional field is going to replace the following line with a valid number
# serial_number
31 changes: 31 additions & 0 deletions e2e_tests/tests/all_providers/config/tomls/slot_number_only.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[core_settings]
# The CI already timestamps the logs
log_timestamp = false
log_error_details = true

# The container runs the Parsec service as root, so make sure we disable root
# checks.
allow_root = true

[listener]
listener_type = "DomainSocket"
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
# that the service does not hang for very big values of body or authentication length.
timeout = 3000 # in milliseconds
socket_path = "/tmp/parsec.sock"

[authenticator]
auth_type = "Direct"

[[key_manager]]
name = "sqlite-manager"
manager_type = "SQLite"
database_path = "./kim-mappings/sqlite/sqlite-key-info-manager.sqlite3"

[[provider]]
provider_type = "Pkcs11"
key_info_manager = "sqlite-manager"
library_path = "/usr/local/lib/softhsm/libsofthsm2.so"
user_pin = "123456"
# The slot_number optional field is going to replace the following line with a valid number
# slot_number
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[core_settings]
# The CI already timestamps the logs
log_timestamp = false
log_error_details = true

# The container runs the Parsec service as root, so make sure we disable root
# checks.
allow_root = true

[listener]
listener_type = "DomainSocket"
# The timeout needs to be smaller than the test client timeout (five seconds) as it is testing
# that the service does not hang for very big values of body or authentication length.
timeout = 3000 # in milliseconds
socket_path = "/tmp/parsec.sock"

[authenticator]
auth_type = "Direct"

[[key_manager]]
name = "sqlite-manager"
manager_type = "SQLite"
database_path = "./kim-mappings/sqlite/sqlite-key-info-manager.sqlite3"

[[provider]]
provider_type = "Pkcs11"
key_info_manager = "sqlite-manager"
library_path = "/usr/local/lib/softhsm/libsofthsm2.so"
user_pin = "123456"
# A dummy slot_number
slot_number=12345678
# The serial number optional field is going to replace the following line with a valid number
# serial_number

0 comments on commit ae0f507

Please sign in to comment.