Skip to content

Commit 14e5f94

Browse files
Vsan stretch tests to run on isolated setup
1 parent 954203f commit 14e5f94

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

tests/e2e/vsan_stretched_cluster.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ var _ = ginkgo.Describe("[vsan-stretch-vanilla] vsan stretched cluster tests", f
128128
ginkgo.Skip(envStoragePolicyNameWithThickProvision + " env variable not set")
129129
}
130130
sc, err := client.StorageV1().StorageClasses().Get(ctx, defaultNginxStorageClassName, metav1.GetOptions{})
131-
framework.Logf("Storageclass is %v and err is %v", sc, err)
132-
if (!strings.Contains(err.Error(), "not found")) && sc != nil {
131+
if err != nil && (!strings.Contains(err.Error(), "not found")) && sc != nil {
133132
framework.ExpectNoError(client.StorageV1().StorageClasses().Delete(ctx, defaultNginxStorageClassName,
134133
*metav1.NewDeleteOptions(0)), "Unable to delete storage class "+defaultNginxStorageClassName)
135134
}

tests/e2e/vsan_stretched_cluster_utils.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,37 @@ func createFaultDomainMap(ctx context.Context, vs *vSphere) map[string]string {
220220
return fdMap
221221
}
222222

223+
func isSSHReachable(ip string, timeout time.Duration) error {
224+
nimbusGeneratedK8sVmPwd := GetAndExpectStringEnvVar(nimbusK8sVmPwd)
225+
sshClientConfig := &ssh.ClientConfig{
226+
User: "root",
227+
Auth: []ssh.AuthMethod{
228+
ssh.Password(nimbusGeneratedK8sVmPwd),
229+
},
230+
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
231+
}
232+
// Read hosts sshd port number
233+
ip, portNum, err := getPortNumAndIP(ip)
234+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
235+
addr := ip + ":" + portNum
236+
_, err = ssh.Dial("tcp", addr, sshClientConfig)
237+
return err
238+
}
239+
223240
// waitForHostToBeDown wait for host to be down
224241
func waitForHostToBeDown(ctx context.Context, ip string) error {
225242
framework.Logf("checking host status of %s", ip)
226243
gomega.Expect(ip).NotTo(gomega.BeNil())
227244
gomega.Expect(ip).NotTo(gomega.BeEmpty())
228-
// Read hosts sshd port number
245+
/* Read hosts sshd port number
229246
ip, portNum, err := getPortNumAndIP(ip)
230247
gomega.Expect(err).NotTo(gomega.HaveOccurred())
231-
addr := ip + ":" + portNum
248+
addr := ip + ":" + portNum*/
232249

233250
waitErr := wait.PollUntilContextTimeout(ctx, poll*2, pollTimeoutShort*2, true,
234251
func(ctx context.Context) (bool, error) {
235-
_, err := net.DialTimeout("tcp", addr, poll)
252+
//_, err := net.DialTimeout("tcp", addr, poll)
253+
err := isSSHReachable(ip, poll)
236254
if err == nil {
237255
framework.Logf("host is reachable")
238256
return false, nil

0 commit comments

Comments
 (0)