コード例 #1
0
func TestGetServerHardwareTypes(t *testing.T) {
	var (
		c *ov.OVClient
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		_, c = getTestDriverA("test_server_hardware_type")
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		serverHardwareTypes, err := c.GetServerHardwareTypes("", "")
		assert.NoError(t, err, "GetServerHardwareTypes threw error -> %s, %+v\n", err, serverHardwareTypes)

		serverHardwareTypes, err = c.GetServerHardwareTypes("", "name:asc")
		assert.NoError(t, err, "GetServerHardwareTypes name:asc error -> %s, %+v\n", err, serverHardwareTypes)

	} else {
		_, c = getTestDriverU("test_server_hardware_type")
		data, err := c.GetServerHardwareTypes("", "")
		assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data))
	}
}