Skip to content

Commit

Permalink
test: add get_smb_svc_public_ip.sh script
Browse files Browse the repository at this point in the history
fix golint
  • Loading branch information
andyzhangx committed Dec 31, 2023
1 parent 2c54ee5 commit 2e65313
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package e2e
import (
"fmt"
"log"
"os"
"os/exec"
"strings"

Expand Down Expand Up @@ -57,8 +58,17 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
ns = f.Namespace

if isUsingHostProcessDeployment {
log.Printf("trying to get smb-server service IP address since it's using host process deployment...")
cmd := exec.Command("kubectl", "get svc smb-server | grep smb | awk '{print $4}'")
err := os.Chdir("../..")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
defer func() {
err := os.Chdir("test/e2e")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}()

getSMBPublicIPScript := "test/utils/get_smb_svc_public_ip.sh"
log.Printf("run script: %s\n", getSMBPublicIPScript)

cmd := exec.Command("bash", getSMBPublicIPScript)
output, err := cmd.CombinedOutput()
log.Printf("got output: %v, error: %v\n", string(output), err)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expand Down
19 changes: 19 additions & 0 deletions test/utils/get_smb_svc_public_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Copyright 2023 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 -e
kubectl get svc smb-server | grep smb | awk '{print $4}'

0 comments on commit 2e65313

Please sign in to comment.