Skip to content

Commit

Permalink
Merge pull request #1029 from chu11/issue1028
Browse files Browse the repository at this point in the history
test/security: Fix test corner case
  • Loading branch information
garlick committed Apr 5, 2017
2 parents ac055a9 + 7d891ae commit a9f4cd5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/common/libflux/test/security.c
Expand Up @@ -98,13 +98,16 @@ void test_keygen (void)
flux_sec_destroy (sec);

/* Nonexistent confdir.
*
* errno has multiple possibilities depending on system, EACCES,
* EROFS, EPERM, etc. Simply check for failure and errno != 0.
*/
sec = flux_sec_create (0, "/noexist");
if (!sec)
BAIL_OUT ("flux_sec_create failed");
errno = 0;
ok (flux_sec_keygen (sec) < 0 && errno == EACCES,
"flux_sec_keygen fails with EACCES if confdir does not exist");
ok (flux_sec_keygen (sec) < 0 && errno != 0,
"flux_sec_keygen fails with errno != 0 if confdir does not exist");
flux_sec_destroy (sec);

/* Same with FORCE flag.
Expand All @@ -113,8 +116,8 @@ void test_keygen (void)
if (!sec)
BAIL_OUT ("flux_sec_create failed");
errno = 0;
ok (flux_sec_keygen (sec) < 0 && errno == EACCES,
"flux_sec_keygen (force) fails with EACCES if confdir does not exist");
ok (flux_sec_keygen (sec) < 0 && errno != 0,
"flux_sec_keygen (force) fails with errno != 0 if confdir does not exist");
flux_sec_destroy (sec);

/* No security modes selected.
Expand Down

0 comments on commit a9f4cd5

Please sign in to comment.