-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Eckert
committed
Sep 23, 2021
1 parent
ac54056
commit 5f2cb60
Showing
5 changed files
with
142 additions
and
7 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
28 changes: 28 additions & 0 deletions
28
charts/consul/test/unit/gossip-encryption-autogeneration-podsecurity.bats
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,28 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "gossipEncryptionAutogeneration/PodSecurityPolicy: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-podsecuritypolicy.yaml \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/PodSecurityPolicy: disabled with global.gossipEncryption.autoGenerate=false" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-podsecuritypolicy.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=false' \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/PodSecurityPolicy: enabled with global.gossipEncryption.autoGenerate=test" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/gossip-encryption-autogeneration-podsecuritypolicy.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=true' \ | ||
. | tee /dev/stderr | | ||
yq -s 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} |
28 changes: 28 additions & 0 deletions
28
charts/consul/test/unit/gossip-encryption-autogeneration-role.bats
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,28 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "gossipEncryptionAutogeneration/Role: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-role.yaml \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/Role: disabled with global.gossipEncryption.autoGenerate=false" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-role.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=false' \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/Role: enabled when global.gossipEncryption.autoGenerate=true" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/gossip-encryption-autogeneration-role.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=true' \ | ||
. | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} |
29 changes: 29 additions & 0 deletions
29
charts/consul/test/unit/gossip-encryption-autogeneration-rolebinding.bats
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,29 @@ | ||
|
||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "gossipEncryptionAutogeneration/RoleBinding: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-rolebinding.yaml \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/RoleBinding: disabled with global.gossipEncryption.autoGenerate=false" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-rolebinding.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=false' \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/RoleBinding: enabled with global.gossipEncryption.autoGenerate=true" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/gossip-encryption-autogeneration-rolebinding.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=true' \ | ||
. | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} |
50 changes: 50 additions & 0 deletions
50
charts/consul/test/unit/gossip-encryption-autogeneration-serviceaccount.bats
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,50 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "gossipEncryptionAutogeneration/ServiceAccount: disabled by default" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-serviceaccount.yaml \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/ServiceAccount: disabled with global.gossipEncryption.autoGenerate=false" { | ||
cd `chart_dir` | ||
assert_empty helm template \ | ||
-s templates/gossip-encryption-autogeneration-serviceaccount.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=false' \ | ||
. | ||
} | ||
|
||
@test "gossipEncryptionAutogeneration/ServiceAccount: enabled with global.gossipEncryption.autoGenerate=true" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
-s templates/gossip-encryption-autogeneration-serviceaccount.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=true' \ | ||
. | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "true" ] | ||
} | ||
|
||
#-------------------------------------------------------------------- | ||
# global.imagePullSecrets | ||
|
||
@test "gossipEncryptionAutogeneration/ServiceAccount: can set image pull secrets" { | ||
cd `chart_dir` | ||
local object=$(helm template \ | ||
-s templates/gossip-encryption-autogeneration-serviceaccount.yaml \ | ||
--set 'global.gossipEncryption.autoGenerate=true' \ | ||
--set 'global.imagePullSecrets[0].name=my-secret' \ | ||
--set 'global.imagePullSecrets[1].name=my-secret2' \ | ||
. | tee /dev/stderr) | ||
|
||
local actual=$(echo "$object" | | ||
yq -r '.imagePullSecrets[0].name' | tee /dev/stderr) | ||
[ "${actual}" = "my-secret" ] | ||
|
||
local actual=$(echo "$object" | | ||
yq -r '.imagePullSecrets[1].name' | tee /dev/stderr) | ||
[ "${actual}" = "my-secret2" ] | ||
} | ||
|