Skip to content

Commit

Permalink
test: fix external test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Oct 14, 2023
1 parent acf65c7 commit 5516a66
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
3 changes: 0 additions & 3 deletions hack/verify-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ EXAMPLES=(\
deploy/example/deployment.yaml \
deploy/example/statefulset.yaml \
deploy/example/statefulset-nonroot.yaml \
deploy/example/deployment-nfs.yaml \
deploy/example/statefulset-nfs.yaml \
deploy/example/statefulset-nonroot-nfs.yaml \
)

for EXAMPLE in "${EXAMPLES[@]}"; do
Expand Down
21 changes: 13 additions & 8 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ var blobDriver *blob.Driver
var projectRoot string

type testCmd struct {
command string
args []string
startLog string
endLog string
command string
args []string
startLog string
endLog string
ignoreError bool
}

func TestMain(m *testing.M) {
Expand Down Expand Up @@ -160,10 +161,11 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte {
var _ = ginkgo.SynchronizedAfterSuite(func(ctx ginkgo.SpecContext) {},
func(ctx ginkgo.SpecContext) {
blobLog := testCmd{
command: "bash",
args: []string{"test/utils/blob_log.sh"},
startLog: "==============start blob log(after suite)===================",
endLog: "==============end blob log(after suite)===================",
command: "bash",
args: []string{"test/utils/blob_log.sh"},
startLog: "==============start blob log(after suite)===================",
endLog: "==============end blob log(after suite)===================",
ignoreError: true,
}
e2eTeardown := testCmd{
command: "make",
Expand Down Expand Up @@ -206,6 +208,9 @@ func execTestCmd(cmds []testCmd) {
err := cmdSh.Run()
if err != nil {
log.Printf("Failed to run command: %s %s, Error: %s\n", cmd.command, strings.Join(cmd.args, " "), err.Error())
if !cmd.ignoreError {
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}
}
gomega.Expect(err).NotTo(gomega.HaveOccurred())
log.Println(cmd.endLog)
Expand Down
2 changes: 1 addition & 1 deletion test/external-e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
set -xe

PROJECT_ROOT=$(git rev-parse --show-toplevel)
DRIVER="test"
DRIVER="blob"

setup_e2e_binaries() {
# download k8s external e2e binary
Expand Down
2 changes: 1 addition & 1 deletion test/external-e2e/testdriver-blobfuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ShortName: blobfuse
StorageClass:
FromFile: /tmp/csi/storageclass.yaml
DriverInfo:
Name: test.csi.azure.com
Name: blob.csi.azure.com
Capabilities:
persistence: true
exec: true
Expand Down
2 changes: 1 addition & 1 deletion test/external-e2e/testdriver-nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ShortName: blobfuse
StorageClass:
FromFile: /tmp/csi/storageclass.yaml
DriverInfo:
Name: test.csi.azure.com
Name: blob.csi.azure.com
Capabilities:
persistence: true
exec: true
Expand Down
17 changes: 11 additions & 6 deletions test/utils/blob_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
# set -e

NS=kube-system
CONTAINER=blob
Expand Down Expand Up @@ -49,11 +49,6 @@ kubectl get pods -n${NS} -l${LABEL} \
| awk 'NR>1 {print $1}' \
| xargs -I {} kubectl logs {} --prefix -c${CONTAINER} -n${NS}

echo "print out cloudprovider_azure metrics ..."
echo "======================================================================================"
ip=`kubectl get svc csi-$DRIVER-controller -n kube-system | awk '{print $4}'`
curl http://$ip:29634/metrics

if [ -n "$ENABLE_BLOBFUSE_PROXY" ]; then
echo "print out install-blobfuse-proxy logs ..."
echo "======================================================================================"
Expand All @@ -64,4 +59,14 @@ if [ -n "$ENABLE_BLOBFUSE_PROXY" ]; then
| xargs -I {} kubectl logs {} --prefix -c${PROXY} -n${NS}
fi

echo "======================================================================================"
ip=`kubectl get svc csi-$DRIVER-controller -n kube-system | awk '{print $4}'`
if echo "$ip" | grep -q "\."; then
echo "print out cloudprovider_azure metrics ..."
curl http://$ip:29634/metrics
else
echo "csi-$DRIVER-controller service ip is empty"
kubectl get svc csi-$DRIVER-controller -n kube-system
fi


0 comments on commit 5516a66

Please sign in to comment.