Skip to content

Commit

Permalink
Merge pull request juju#17367 from ycliuhw/fix-secret-ci
Browse files Browse the repository at this point in the history
juju#17367

This PR disabled auto prune and drain secret bash tests because they are not implemented in Dqlite yet.

```
./main.sh -v -p microk8s '""' secrets_iaas test_secrets_juju

./main.sh -v -p microk8s '""' secrets_iaas test_secrets_cmr
```
  • Loading branch information
jujubot authored May 14, 2024
2 parents ecfeccf + 4e531b1 commit 18b7033
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions tests/suites/secrets_iaas/juju.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ run_user_secrets() {
app_name='easyrsa-user-secrets'
juju --show-log deploy easyrsa "$app_name"

wait_for "active" '.applications["easyrsa-user-secrets"] | ."application-status".current'

# create user secrets.
secret_uri=$(juju --show-log add-secret mysecret owned-by="$model_name-1" --info "this is a user secret")
secret_short_uri=${secret_uri##*:}
Expand Down Expand Up @@ -107,7 +109,8 @@ run_user_secrets() {
# revision 1 should be pruned.
# revision 2 is still been used by the app, so it should not be pruned.
# revision 3 is the latest revision, so it should not be pruned.
check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '2'
# TODO: enable once the auto-prune is implemented in DQlite.
# check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '2'
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 2 | yq .${secret_short_uri}.content)" "owned-by: $model_name-2"
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 3 | yq .${secret_short_uri}.content)" "owned-by: $model_name-3"

Expand All @@ -117,7 +120,8 @@ run_user_secrets() {

# revision 2 should be pruned.
# revision 3 is the latest revision, so it should not be pruned.
check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '1'
# TODO: enable once the auto-prune is implemented in DQlite.
# check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '1'
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 3 | yq .${secret_short_uri}.content)" "owned-by: $model_name-3"

juju --show-log revoke-secret mysecret "$app_name"
Expand Down
6 changes: 4 additions & 2 deletions tests/suites/secrets_iaas/vault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ test_secret_drain() {

cd .. || exit

run "run_secret_drain"
# TODO: drain is not implemented in DQlite yet.
# run "run_secret_drain"
)
}

Expand All @@ -213,7 +214,8 @@ test_user_secret_drain() {

cd .. || exit

run "run_user_secret_drain"
# TODO: drain is not implemented in DQlite yet.
# run "run_user_secret_drain"
)
}

Expand Down
14 changes: 10 additions & 4 deletions tests/suites/secrets_k8s/k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ run_user_secrets() {

juju --show-log deploy hello-kubecon

wait_for "active" '.applications["hello-kubecon"] | ."application-status".current'

# create user secrets.
secret_uri=$(juju --show-log add-secret mysecret owned-by="$model_name-1" --info "this is a user secret")
secret_short_uri=${secret_uri##*:}
Expand Down Expand Up @@ -140,7 +142,8 @@ run_user_secrets() {
# revision 1 should be pruned.
# revision 2 is still been used by hello-kubecon app, so it should not be pruned.
# revision 3 is the latest revision, so it should not be pruned.
check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '2'
# TODO: enable once the auto-prune is implemented in DQlite.
# check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '2'
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 2 | yq .${secret_short_uri}.content)" "owned-by: $model_name-2"
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 3 | yq .${secret_short_uri}.content)" "owned-by: $model_name-3"

Expand All @@ -150,7 +153,8 @@ run_user_secrets() {

# revision 2 should be pruned.
# revision 3 is the latest revision, so it should not be pruned.
check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '1'
# TODO: enable once the auto-prune is implemented in DQlite.
# check_contains "$(juju --show-log show-secret $secret_uri --revisions | yq ".${secret_short_uri}.revisions | length")" '1'
check_contains "$(juju --show-log show-secret $secret_uri --reveal --revision 3 | yq .${secret_short_uri}.content)" "owned-by: $model_name-3"

juju --show-log revoke-secret $secret_uri hello-kubecon
Expand Down Expand Up @@ -353,7 +357,8 @@ test_secret_drain() {

cd .. || exit

run "run_secret_drain"
# TODO: drain is not implemented in DQlite yet.
# run "run_secret_drain"
)
}

Expand All @@ -368,6 +373,7 @@ test_user_secret_drain() {

cd .. || exit

run "run_user_secret_drain"
# TODO: drain is not implemented in DQlite yet.
# run "run_user_secret_drain"
)
}

0 comments on commit 18b7033

Please sign in to comment.