This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #604 from intel/full-test-fixes
full test fixes
- Loading branch information
Showing
10 changed files
with
141 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright 2020 Intel Corporation. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package deploy | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"strings" | ||
|
||
pmemcsidriver "github.com/intel/pmem-csi/pkg/pmem-csi-driver" | ||
|
||
. "github.com/onsi/gomega" | ||
) | ||
|
||
// Register list of volumes before test, using out-of-band host commands (i.e. not CSI API). | ||
func GetHostVolumes(d *Deployment) map[string][]string { | ||
var cmd string | ||
var hdr string | ||
switch d.Mode { | ||
case pmemcsidriver.LVM: | ||
// lvs adds many space (0x20) chars at end, we could squeeze | ||
// repetitions using tr here, but TrimSpace() below strips those away | ||
cmd = "sudo lvs --foreign --noheadings" | ||
hdr = "LVM Volumes" | ||
case pmemcsidriver.Direct: | ||
// ndctl produces multiline block. We want one line per namespace. | ||
// Pick uuid, mode, size for comparison. Note that sorting changes the order so lines | ||
// are not grouped by volume, but keeping volume order would need more complex parsing | ||
// and this is not meant to be pretty-printed for human, just to detect the change. | ||
cmd = "sudo ndctl list |tr -d '\"' |egrep 'uuid|mode|^ *size' |sort |tr -d ' \n'" | ||
hdr = "Namespaces" | ||
} | ||
result := make(map[string][]string) | ||
// Instead of trying to find out number of hosts, we trust the set of | ||
// ssh.N helper scripts matches running hosts, which should be the case in | ||
// correctly running tester system. We run ssh.N commands until a ssh.N | ||
// script appears to be "no such file". | ||
for worker := 1; ; worker++ { | ||
sshcmd := fmt.Sprintf("%s/_work/%s/ssh.%d", os.Getenv("REPO_ROOT"), os.Getenv("CLUSTER"), worker) | ||
ssh := exec.Command(sshcmd, cmd) | ||
// Intentional Output instead of CombinedOutput to dismiss warnings from stderr. | ||
// lvs may emit lvmetad-related WARNING msg which can't be silenced using -q option. | ||
out, err := ssh.Output() | ||
if err != nil && os.IsNotExist(err) { | ||
break | ||
} | ||
buf := fmt.Sprintf("%s on Node %d", hdr, worker) | ||
result[buf] = strings.Split(strings.TrimSpace(string(out)), "\n") | ||
} | ||
return result | ||
} | ||
|
||
// CheckForLeftovers lists volumes again after test, diff means leftovers. | ||
func CheckForLeftoverVolumes(d *Deployment, volBefore map[string][]string) { | ||
volNow := GetHostVolumes(d) | ||
Expect(volNow).To(Equal(volBefore), "same volumes before and after the test") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,9 +143,39 @@ TEST_E2E_SKIP_ALL = $(TEST_E2E_SKIP) | |
# https://github.com/kubernetes/kubernetes/blob/25ffbe633810609743944edd42d164cd7990071c/test/e2e/storage/testsuites/provisioning.go#L175-L181 | ||
TEST_E2E_SKIP_ALL += should.access.volume.from.different.nodes | ||
|
||
# This is a test for behavior of kubelet which Kubernetes <= 1.15 doesn't pass. | ||
TEST_E2E_SKIP_1.14 += volumeMode.should.not.mount.*map.unused.volumes.in.a.pod | ||
TEST_E2E_SKIP_1.15 += volumeMode.should.not.mount.*map.unused.volumes.in.a.pod | ||
|
||
# It looks like Kubernetes <= 1.15 does not wait for | ||
# NodeUnpublishVolume to complete before deleting the pod: | ||
# | ||
# Apr 21 17:33:12.743: INFO: Wait up to 5m0s for pod "dax-volume-test" to be fully deleted | ||
# pmem-csi-node-4dsmr/[email protected]: I0421 17:33:34.491659 1 tracing.go:19] GRPC call: /csi.v1.Node/NodeGetCapabilities | ||
# pmem-csi-node-4dsmr/[email protected]: I0421 17:33:45.549013 1 tracing.go:19] GRPC call: /csi.v1.Node/NodeUnpublishVolume | ||
# pmem-csi-node-4dsmr/[email protected]: I0421 17:33:45.549189 1 nodeserver.go:295] NodeUnpublishVolume: unmount /var/lib/kubelet/pods/1c5f1fec-b08b-4264-8c55-40a22c1b3d16/volumes/kubernetes.io~csi/vol1/mount | ||
# STEP: delete the pod | ||
# Apr 21 17:33:46.769: INFO: Waiting for pod dax-volume-test to disappear | ||
# Apr 21 17:33:46.775: INFO: Pod dax-volume-test no longer exists | ||
# | ||
# That breaks our volume leak detection because the test continues | ||
# before the volume is truly removed. As a workaround, we disable | ||
# ephemeral volume tests on Kubernetes <= 1.15. That's okay because the feature | ||
# was alpha in those releases and shouldn't be used. | ||
TEST_E2E_SKIP_1.14 += Testpattern:.Ephemeral-volume Testpattern:.inline.ephemeral.CSI.volume | ||
TEST_E2E_SKIP_1.15 += Testpattern:.Ephemeral-volume Testpattern:.inline.ephemeral.CSI.volume | ||
|
||
# Add all Kubernetes version-specific suppressions. | ||
TEST_E2E_SKIP_ALL += $(TEST_E2E_SKIP_$(shell cat _work/$(CLUSTER)/kubernetes.version)) | ||
|
||
# E2E tests which are to be executed (space separated list of regular expressions, default is all that aren't skipped). | ||
TEST_E2E_FOCUS = | ||
|
||
foobar: | ||
echo TEST_E2E_SKIP_$(shell cat _work/$(CLUSTER)/kubernetes.version) | ||
echo $(TEST_E2E_SKIP_$(shell cat _work/$(CLUSTER)/kubernetes.version)) | ||
echo $(TEST_E2E_SKIP_ALL) | ||
|
||
# E2E Junit output directory (default empty = none). junit_<ginkgo node>.xml files will be written there, | ||
# i.e. usually just junit_01.xml. | ||
TEST_E2E_REPORT_DIR= | ||
|