]> xenbits.xensource.com Git - people/gdunlap/xsatool.git/commitdiff
system_test: Check for specific versions, not just presence
authorGeorge Dunlap <george.dunlap@citrix.com>
Wed, 17 May 2017 16:51:23 +0000 (17:51 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 17 May 2017 16:51:23 +0000 (17:51 +0100)
Check for the specific versions, not just the presence of the
branches.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
system_test.go

index 4b640017b1648b6d5154e682639fc70f965c9d61..d617b13cabef58fd8863180c35d1e26795584962 100644 (file)
@@ -151,37 +151,50 @@ func InitRepo(t *testing.T) bool {
        return true
 }
 
-func GlobalInit(t *testing.T) bool {
+func GlobalInit(t *testing.T) (pass bool) {
        //args := []string{"xsatool", "global", "update"}
+       pass = true
+
        QuerySetResponses([]string{"4.4"})
        if MainHarness("global", "update") != 0 {
                return false
        }
 
        // Check to see that we have the expected
-       versions := map[XenVersion]bool{
-               "4.8": false,
-               "4.7": false,
-               "4.6": false,
-               "4.5": false,
-               "4.4": false,
+       versions := map[XenVersion]*struct {
+               fv   XenVersionFull
+               seen bool
+       }{
+               "4.8":    {fv: "4.8.0"},
+               "4.7":    {fv: "4.7.2"},
+               "4.6":    {fv: "4.6.5"},
+               "4.5":    {fv: "4.5.5"},
+               "4.4":    {fv: "4.4.4"},
        }
 
        for v := range G.config.Security.Versions {
                _, prs := versions[v]
                if !prs {
                        t.Errorf("Unexpected version: %v\n", v)
+                       pass = false
                } else {
-                       versions[v] = true
+                       versions[v].seen = true
+                       if versions[v].fv != G.config.Security.Versions[v].Latest {
+                               t.Errorf("Expected fullversion %v, got %v\n",
+                                       versions[v].fv,
+                                       G.config.Security.Versions[v].Latest)
+                               pass = false
+                       }
                }
        }
 
-       for v, seen := range versions {
-               if !seen {
+       for v := range versions {
+               if !versions[v].seen {
                        t.Errorf("Didn't find expected xenversion %v\n", v)
+                       pass = false
                }
        }
-       return true
+       return pass
 }
 
 func TestSystem(t *testing.T) {