From e4743d8273663bf96e3d02732809263b79accfeb Mon Sep 17 00:00:00 2001 From: Arzhan Kinzhalin Date: Wed, 2 Jan 2019 14:03:31 -0800 Subject: [PATCH] Fix tests. Corrected expected file counts in the store where ls or find are used. It's count + 1 now due to extra symlink clrtrust generates. --- test/add-negative.bats | 3 ++- test/add-remove-with-spaces.bats | 2 +- test/add-remove.bats | 2 +- test/distrust-add-clear.bats | 2 +- test/generate-clear.bats | 2 +- test/generate-duplicates.bats | 6 +++--- test/generate-internal-rehash.bats | 4 ++-- test/generate-local.bats | 2 +- test/generate-mix.bats | 2 +- test/generate-with-distrusted.bats | 2 +- test/remove-positive.bats | 2 +- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/test/add-negative.bats b/test/add-negative.bats index 94a020c..3f6662b 100755 --- a/test/add-negative.bats +++ b/test/add-negative.bats @@ -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" ] diff --git a/test/add-remove-with-spaces.bats b/test/add-remove-with-spaces.bats index 366b29e..4be571b 100755 --- a/test/add-remove-with-spaces.bats +++ b/test/add-remove-with-spaces.bats @@ -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) diff --git a/test/add-remove.bats b/test/add-remove.bats index 7400821..8195482 100755 --- a/test/add-remove.bats +++ b/test/add-remove.bats @@ -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" ] diff --git a/test/distrust-add-clear.bats b/test/distrust-add-clear.bats index 5fc62c7..3adea30 100755 --- a/test/distrust-add-clear.bats +++ b/test/distrust-add-clear.bats @@ -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 diff --git a/test/generate-clear.bats b/test/generate-clear.bats index d560174..185abf4 100755 --- a/test/generate-clear.bats +++ b/test/generate-clear.bats @@ -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 ] diff --git a/test/generate-duplicates.bats b/test/generate-duplicates.bats index a011631..4779540 100755 --- a/test/generate-duplicates.bats +++ b/test/generate-duplicates.bats @@ -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 ] } @@ -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 @@ -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 diff --git a/test/generate-internal-rehash.bats b/test/generate-internal-rehash.bats index 35c89ad..edf42dc 100755 --- a/test/generate-internal-rehash.bats +++ b/test/generate-internal-rehash.bats @@ -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 ] diff --git a/test/generate-local.bats b/test/generate-local.bats index b5b41f0..2256650 100755 --- a/test/generate-local.bats +++ b/test/generate-local.bats @@ -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 ] diff --git a/test/generate-mix.bats b/test/generate-mix.bats index 520e89e..aa40050 100755 --- a/test/generate-mix.bats +++ b/test/generate-mix.bats @@ -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 ] diff --git a/test/generate-with-distrusted.bats b/test/generate-with-distrusted.bats index 924c3aa..75837f2 100755 --- a/test/generate-with-distrusted.bats +++ b/test/generate-with-distrusted.bats @@ -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 ] } diff --git a/test/remove-positive.bats b/test/remove-positive.bats index dd7bd85..3c82342 100755 --- a/test/remove-positive.bats +++ b/test/remove-positive.bats @@ -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