Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
Corrected expected file counts in the store where ls or find are used.
It's count + 1 now due to extra symlink clrtrust generates.
  • Loading branch information
busykai committed Jan 2, 2019
1 parent 82f66ef commit e4743d8
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion test/add-negative.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ setup() {
@test "generate empty store, fail to add certificates" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 0 ]
ls $STORE/anchors
[ $cnt -eq 1 ]
run $CLRTRUST list
[ $status -eq 0 ]
[ -z "$output" ]
Expand Down
2 changes: 1 addition & 1 deletion test/add-remove-with-spaces.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
@test "add, remove files with spaces in names" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 2 ] # file and symlink
[ $cnt -eq 3 ] # file and symlink
run $CLRTRUST list
[ $status -eq 0 ]
cnt=$(echo "$output"| grep ^id | wc -l)
Expand Down
2 changes: 1 addition & 1 deletion test/add-remove.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ setup() {
@test "generate empty store, add certificate" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 0 ]
[ $cnt -eq 1 ]
run $CLRTRUST list
[ $status -eq 0 ]
[ -z "$output" ]
Expand Down
2 changes: 1 addition & 1 deletion test/distrust-add-clear.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup() {
@test "distrust Clear-provided cert, add it back" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
$CLRTRUST remove $CERTS/c1.pem
Expand Down
2 changes: 1 addition & 1 deletion test/generate-clear.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
@test "generate store, all provided by Clear Linux" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
[ -f $STORE/compat/ca-roots.keystore ]
Expand Down
6 changes: 3 additions & 3 deletions test/generate-duplicates.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ setup() {
run $CLRTRUST generate
[ $status -eq 0 ]
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
}
Expand All @@ -28,7 +28,7 @@ setup() {
run $CLRTRUST generate
[ $status -eq 0 ]
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
$CLRTRUST list
Expand All @@ -39,7 +39,7 @@ setup() {
run $CLRTRUST generate
[ $status -eq 0 ]
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
$CLRTRUST list
Expand Down
4 changes: 2 additions & 2 deletions test/generate-internal-rehash.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ setup() {
@test "generate store, using internal rehash" {
$CLRTRUST -c generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$(find $STORE/anchors -type l | wc -l)
[ $cnt -eq 4 ]
[ $cnt -eq 5 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
[ -f $STORE/compat/ca-roots.keystore ]
Expand Down
2 changes: 1 addition & 1 deletion test/generate-local.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
@test "generate store, all local" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
[ -f $STORE/compat/ca-roots.keystore ]
Expand Down
2 changes: 1 addition & 1 deletion test/generate-mix.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup() {
@test "generate store, source both Clear and local" {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
[ -f $STORE/compat/ca-roots.keystore ]
Expand Down
2 changes: 1 addition & 1 deletion test/generate-with-distrusted.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ setup() {
$CLRTRUST generate
cnt=$(ls $STORE/anchors | wc -l)
[ ! -f $STORE/anchors/c2.pem ]
[ $cnt -eq 6 ]
[ $cnt -eq 7 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 3 ]
}
Expand Down
2 changes: 1 addition & 1 deletion test/remove-positive.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ setup() {
run $CLRTRUST generate
[ $status -eq 0 ]
cnt=$(ls $STORE/anchors | wc -l)
[ $cnt -eq 8 ]
[ $cnt -eq 9 ]
cnt=$($CLRTRUST list | grep ^id | wc -l)
[ $cnt -eq 4 ]
# removing a Clear-provided CA should "distrust" it, not remove
Expand Down

0 comments on commit e4743d8

Please sign in to comment.