From 9670aa8505d64d92c0dd49262e1b42d4cedc4752 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Sat, 21 Jan 2017 23:12:41 +1000 Subject: [PATCH] Add an integration test for os-release Signed-off-by: Sven Dowideit --- tests/os-release-test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/os-release-test.go diff --git a/tests/os-release-test.go b/tests/os-release-test.go new file mode 100644 index 00000000..123c9dde --- /dev/null +++ b/tests/os-release-test.go @@ -0,0 +1,28 @@ +package integration + +import ( + "strings" + . "gopkg.in/check.v1" +) + +func (s *QemuSuite) TestOsRelease(c *C) { + s.RunQemu(c) + version := "" + version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v") + version = strings.Replace(version, "ros version ", "", 1) + s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=") + s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=") + + s.MakeCall("sudo ros console switch -f alpine") + c.Assert(s.WaitForSSH(), IsNil) + + s.CheckOutput(c, "/sbin/apk\n", Equals, "which apk") + s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=") + s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=") + + s.Reboot(c) + + s.CheckOutput(c, "/sbin/apk\n", Equals, "which apk") + s.CheckOutput(c, "VERSION="+version, Equals, "cat /etc/os-release | grep VERSION=") + s.CheckOutput(c, "NAME=\"RancherOS\"\n", Equals, "cat /etc/os-release | grep ^NAME=") +}