Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
build: include pmem-dax-check also in normal image
Browse files Browse the repository at this point in the history
The binary is small (2.2M) and has no dependencies other than the Go standard
library and is useful to have around, therefore it makes sense to include it.

The E2E testing then no longer needs to build and copy the binary.
  • Loading branch information
pohly committed Dec 6, 2021
1 parent 6395500 commit 858d2ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ RUN set -x && \
mkdir -p /usr/local/bin && \
mv _output/pmem-csi-driver${BIN_SUFFIX} /usr/local/bin/pmem-csi-driver && \
mv _output/pmem-csi-operator${BIN_SUFFIX} /usr/local/bin/pmem-csi-operator && \
if [ "$BIN_SUFFIX" = "-test" ]; then GOOS=linux GO111MODULE=on \
go build -o /usr/local/bin/pmem-dax-check ./test/cmd/pmem-dax-check; fi && \
go build -o /usr/local/bin/pmem-dax-check ./test/cmd/pmem-dax-check && \
mkdir -p /usr/local/share/package-licenses && \
hack/copy-modules-license.sh /usr/local/share/package-licenses ./cmd/pmem-csi-driver ./cmd/pmem-csi-operator && \
cp /go/LICENSE /usr/local/share/package-licenses/go.LICENSE && \
Expand Down
20 changes: 3 additions & 17 deletions test/e2e/storage/dax/dax.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ type local struct {
root string
}

const (
daxCheckBinary = "_work/pmem-dax-check"
)

func (p *daxTestSuite) DefineTests(driver storageframework.TestDriver, pattern storageframework.TestPattern) {
var l local

Expand All @@ -99,16 +95,6 @@ func (p *daxTestSuite) DefineTests(driver storageframework.TestDriver, pattern s
init := func() {
l = local{}

// Build pmem-dax-check helper binary.
l.root = os.Getenv("REPO_ROOT")
build := exec.Command("/bin/sh", "-c", os.Getenv("GO")+" build -o "+daxCheckBinary+" ./test/cmd/pmem-dax-check")
build.Stdout = GinkgoWriter
build.Stderr = GinkgoWriter
build.Dir = l.root
By("Compiling with: " + strings.Join(build.Args, " "))
err := build.Run()
framework.ExpectNoError(err, "compile ./test/cmd/pmem-dax-check")

// Now do the more expensive test initialization.
l.config, l.testCleanup = driver.PrepareTest(f)
l.resource = storageframework.CreateVolumeResource(driver, l.config, pattern, volume.SizeRange{})
Expand Down Expand Up @@ -360,14 +346,14 @@ func testDax(
}

By("checking that missing DAX support is detected")
pmempod.RunInPod(f, root, []string{daxCheckBinary}, "/tmp/"+path.Base(daxCheckBinary)+" /tmp/no-dax; if [ $? -ne 1 ]; then echo should have reported missing DAX >&2; exit 1; fi", ns, pod.Name, containerName)
pmempod.RunInPod(f, root, nil, "/usr/local/bin/pmem-dax-check /tmp/no-dax; if [ $? -ne 1 ]; then echo should have reported missing DAX >&2; exit 1; fi", ns, pod.Name, containerName)

if expectDax {
By("checking volume for DAX support")
pmempod.RunInPod(f, root, []string{daxCheckBinary}, "lsblk; mount | grep /mnt; /tmp/"+path.Base(daxCheckBinary)+" /mnt/daxtest", ns, pod.Name, containerName)
pmempod.RunInPod(f, root, nil, "lsblk; mount | grep /mnt; /usr/local/bin/pmem-dax-check /mnt/daxtest", ns, pod.Name, containerName)
} else {
By("checking volume for missing DAX support")
stdout, _ := pmempod.RunInPod(f, root, []string{daxCheckBinary}, "ndctl list -NR; lsblk; mount | grep /mnt; /tmp/"+path.Base(daxCheckBinary)+" /mnt/daxtest; if [ $? -ne 1 ]; then echo should have reported missing DAX >&2; exit 1; fi", ns, pod.Name, containerName)
stdout, _ := pmempod.RunInPod(f, root, nil, "ndctl list -NR; lsblk; mount | grep /mnt; /usr/local/bin/pmem-dax-check /mnt/daxtest; if [ $? -ne 1 ]; then echo should have reported missing DAX >&2; exit 1; fi", ns, pod.Name, containerName)

// Example output for LVM:
// {
Expand Down

0 comments on commit 858d2ca

Please sign in to comment.