Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve enclave validation test coverage. #682

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}