コード例 #1
0
// TestGetAPIVersion get the version from endpoints
func TestGetAPIVersion(t *testing.T) {
	var (
		d *OVTest
		c *ov.OVClient
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA("dev")
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		data, err := c.GetAPIVersion()
		// fmt.Printf("after GetAPIVersion: %s -> (err) %s", data.CurrentVersion, err)
		// assert.Error(t,err, fmt.Sprintf("Error caught as expected: %s",err))
		assert.NoError(t, err, "GetAPIVersion threw error -> %s", err)
		assert.True(t, d.Tc.IsGreaterEqual(data.CurrentVersion, d.Tc.GetExpectsData(d.Env, "CurrentVersion")))
		assert.True(t, d.Tc.IsGreaterEqual(data.MinimumVersion, d.Tc.GetExpectsData(d.Env, "MinimumVersion")))
	} else {
		_, c = getTestDriverU("dev")
		data, err := c.GetAPIVersion()
		assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data))
	}

}