Skip to content

Commit

Permalink
Test config drive is unmounted in ginkgo
Browse files Browse the repository at this point in the history
Signed-off-by: Maria Shaldibina <[email protected]>
  • Loading branch information
st3v authored and mariash committed Jan 8, 2015
1 parent 039c719 commit c1a54a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
17 changes: 0 additions & 17 deletions bin/test-integration
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,4 @@ $bin/go install github.com/onsi/ginkgo/ginkgo
echo -e "\n Running tests..."
$bin/env ginkgo -race -trace integration

# check that agent unmounted disk
result=`vagrant ssh -c "sudo mount | grep -c /dev/loop2" | head -c 1`
COUNTER=0

while [ "$result" != "0" ];
do
if [ "$COUNTER" -gt 5 ]; then
echo "FAILURE: Drive not unmounted after five seconds"
exit 1
fi
COUNTER=$((COUNTER+1))
sleep 1
result=`vagrant ssh -c "sudo mount | grep -c /dev/loop2" | head -c 1`
done

echo "SUCCESS: Drive unmounted"

exit 0
10 changes: 10 additions & 0 deletions integration/config_drive_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package integration_test

import (
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

Expand Down Expand Up @@ -54,6 +57,13 @@ var _ = Describe("ConfigDrive", func() {
Expect(err).ToNot(HaveOccurred())
Expect(settingsJSON).To(ContainSubstring("fake-agent-id"))
})

It("config drive is being unmounted", func() {
Eventually(func() string {
result, _ := testEnvironment.RunCommand("sudo mount | grep -c /dev/loop2")
return strings.TrimSpace(result)
}, 5*time.Second, 1*time.Second).Should(Equal("0"))
})
})
})
})

0 comments on commit c1a54a1

Please sign in to comment.