func TestGetServerHardwareTypeByName(t *testing.T) { var ( d *OVTest c *ov.OVClient testName string ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { d, c = getTestDriverA("test_server_hardware_type") if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } testName = d.Tc.GetTestData(d.Env, "Name").(string) testServerHardwareType, err := c.GetServerHardwareTypeByName(testName) assert.NoError(t, err, "GetServerHardwareTypeByName thew an error -> %s", err) assert.Equal(t, testName, testServerHardwareType.Name) testServerHardwareType, err = c.GetServerHardwareTypeByName("bad") assert.Error(t, err, "GetServerHardwareTypeByName with fake name -> %s", err) assert.Equal(t, "", testServerHardwareType.Name) } else { d, c = getTestDriverU("test_server_hardware_type") testName = d.Tc.GetTestData(d.Env, "Name").(string) data, err := c.GetServerHardwareTypeByName(testName) assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data)) } }