Skip to content

Commit

Permalink
test: get smb server external ip
Browse files Browse the repository at this point in the history
fix

fix
  • Loading branch information
andyzhangx committed Aug 13, 2024
1 parent 36bc85e commit 28e2f5f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,19 @@ func getSmbTestEnvVarValue(envVarName string, defaultVarValue string) (smbTestEn
if smbTestEnvValue == "" {
smbTestEnvValue = defaultVarValue
}

if isWindowsCluster && envVarName == testSmbSourceEnvVar {
// get the public IP of the SMB service on Windows
getSMBPublicIPScript := "../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)

server := strings.TrimSuffix(string(output), "\n")
log.Printf("use server on Windows: %s\n", server)
smbTestEnvValue = fmt.Sprintf("//%s/share", server)
}
return
}
18 changes: 18 additions & 0 deletions test/utils/get_smb_svc_public_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Copyright 2020 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 28e2f5f

Please sign in to comment.