Skip to content

Commit

Permalink
Improve enclave validation test coverage. (#682)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
  • Loading branch information
hidmic authored and ahcorde committed Oct 8, 2020
1 parent bba14e9 commit 4965901
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rcl/test/rcl/test_validate_enclave_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ TEST(TestValidateEnclaveName, test_validation_string) {
{"/foo/$", RCL_ENCLAVE_NAME_INVALID_CONTAINS_UNALLOWED_CHARACTERS, 5},
{"/bar#", RCL_ENCLAVE_NAME_INVALID_CONTAINS_UNALLOWED_CHARACTERS, 4},
{"/foo//bar", RCL_ENCLAVE_NAME_INVALID_CONTAINS_REPEATED_FORWARD_SLASH, 5},
{"/1bar", RCL_ENCLAVE_NAME_INVALID_NAME_TOKEN_STARTS_WITH_NUMBER, 1}
{"/1bar", RCL_ENCLAVE_NAME_INVALID_NAME_TOKEN_STARTS_WITH_NUMBER, 1},
{"/" + std::string(RCL_ENCLAVE_NAME_MAX_LENGTH, 'o'),
RCL_ENCLAVE_NAME_INVALID_TOO_LONG,
RCL_ENCLAVE_NAME_MAX_LENGTH - 1}
};
for (const auto & case_tuple : enclave_cases_that_should_fail) {
std::string enclave = case_tuple.enclave;
Expand All @@ -82,4 +85,8 @@ TEST(TestValidateEnclaveName, test_validation_string) {
"Enclave '" << enclave << "' failed with '" << validation_result << "'.";
EXPECT_NE(nullptr, rcl_enclave_name_validation_result_string(validation_result)) << enclave;
}
EXPECT_STREQ(
"unknown result code for rcl context name validation",
rcl_enclave_name_validation_result_string(-1)); // invalid result
EXPECT_EQ(nullptr, rcl_enclave_name_validation_result_string(RCL_ENCLAVE_NAME_VALID));
}

0 comments on commit 4965901

Please sign in to comment.