Skip to content

Commit

Permalink
e2e test of gcp-provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
dargudear-google committed Dec 9, 2024
1 parent 7f00839 commit 7c24b32
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/bats/gcp.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PROVIDER_NAMESPACE=kube-system
PROVIDER_YAML=https://raw.githubusercontent.com/GoogleCloudPlatform/secrets-store-csi-driver-provider-gcp/main/deploy/provider-gcp-plugin.yaml
BASE64_FLAGS="-w 0"

export RESOURCE_NAME=${RESOURCE_NAME:-"projects/735463103342/secrets/test-secret-a/versions/latest"}
export RESOURCE_NAME=${RESOURCE_NAME:-"projects/701052188881/secrets/testsecret/versions/latest"}
export FILE_NAME=${FILE_NAME:-"secret"}
export SECRET_VALUE=${SECRET_VALUE:-"aHVudGVyMg=="}

Expand Down Expand Up @@ -43,8 +43,10 @@ export SECRET_VALUE=${SECRET_VALUE:-"aHVudGVyMg=="}
}

@test "CSI inline volume test with pod portability - read gcp kv secret from pod" {
archive_info
result=$(kubectl exec secrets-store-inline-crd --namespace=$NAMESPACE -- cat /mnt/secrets-store/$FILE_NAME)
[[ "${result//$'\r'}" == "${SECRET_VALUE}" ]]

}

@test "CSI inline volume test with pod portability - unmount succeeds" {
Expand Down
30 changes: 30 additions & 0 deletions test/scripts/run-e2e-gcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

: "${GOOGLE_APPLICATION_CREDENTIALS:?Environment variable empty or not defined.}"

main() {
echo "starting the secret store csi driver test for gcp provider"
# TODOs
# 1. Create a temporary secret in boskos pool once https://github.com/kubernetes/k8s.io/pull/7416 is submitted.
# 2. Rotate secrets created in above step
# 3. Clean up the secret.
make e2e-bootstrap e2e-helm-deploy e2e-gcp
}

0 comments on commit 7c24b32

Please sign in to comment.