This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test simple trust command line actions
Remove a default header in some but not all 'list' commands. Fix the sudigen behavior with respect to uuid and serial-number. Signed-off-by: Serge Hallyn <[email protected]>
- Loading branch information
Showing
8 changed files
with
122 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
MDIR=~/.local/share/machine | ||
BACKUP=~/.local/share/machine.backup | ||
|
||
function common_setup { | ||
export TOP_DIR=$(git rev-parse --show-toplevel) | ||
export PATH=${TOP_DIR}:$PATH | ||
|
||
MDIR=~/.local/share/machine | ||
BACKUP=~/.local/share/machine.backup | ||
if [ -d "$BACKUP" ]; then | ||
rm -rf "$BACKUP" | ||
fi | ||
if [ -d "$MDIR" ]; then | ||
mv "$MDIR" "$BACKUP" | ||
fi | ||
} | ||
|
||
function common_teardown { | ||
if [ -d "$MDIR" ]; then | ||
rm -rf "$MDIR" | ||
fi | ||
if [ -d "$BACKUP" ]; then | ||
mv "$BACKUP" "$MDIR" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load helpers | ||
|
||
function setup() { | ||
common_setup | ||
} | ||
|
||
function teardown() { | ||
common_teardown | ||
} | ||
|
||
@test "Create snakeoil keyset" { | ||
trust keyset add snakeoil | ||
[ -d "$MDIR/trust/keys/snakeoil/.git" ] | ||
trust keyset list | grep snakeoil | ||
} | ||
|
||
@test "Create new keysets" { | ||
trust keyset add zomg | ||
trust keyset add --org "My organization" homenet | ||
cnt=$(trust keyset list | wc -l) | ||
[ $cnt -eq 2 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load helpers | ||
|
||
function setup() { | ||
common_setup | ||
} | ||
|
||
function teardown() { | ||
common_teardown | ||
} | ||
|
||
@test "Keyset creation creates default project" { | ||
trust keyset add zomg | ||
trust project list zomg | grep default | ||
} | ||
|
||
@test "Create project" { | ||
trust keyset add zomg | ||
trust project add zomg newproject | ||
trust project list zomg | grep newproject | ||
cnt=$(trust project list zomg | wc -l) | ||
[ $cnt -eq 2 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
load helpers | ||
|
||
function setup() { | ||
common_setup | ||
} | ||
|
||
function teardown() { | ||
common_teardown | ||
} | ||
|
||
@test "Keyset creation creates sudi" { | ||
trust keyset add zomg | ||
trust sudi list zomg default | ||
} | ||
|
||
@test "Project creation creates sudi" { | ||
trust keyset add zomg | ||
trust project add zomg newproject | ||
trust sudi list zomg newproject | ||
} | ||
|
||
@test "Create sudi" { | ||
trust keyset add zomg | ||
trust project add zomg newproject | ||
trust sudi add zomg newproject # auto-create uuid | ||
trust sudi add zomg newproject 88db65c5-8896-4908-bf8d-8ac04ff20d5c | ||
[ -e "$MDIR/trust/keys/zomg/manifest/newproject/sudi/88db65c5-8896-4908-bf8d-8ac04ff20d5c/cert.pem" ] | ||
trust sudi add zomg newproject SN0001 | ||
trust sudi add zomg newproject SN0002 | ||
trust sudi list zomg newproject | grep SN0001 | ||
cnt=$(trust sudi list zomg newproject | wc -l) | ||
[ $cnt -eq 4 ] | ||
} |