func TestDeleteNetworkSet(t *testing.T) { var ( d *OVTest c *ov.OVClient testName string testNetSet ov.NetworkSet ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { d, c = getTestDriverA("test_network_set") if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } testName = d.Tc.GetTestData(d.Env, "Name").(string) err := c.DeleteNetworkSet(testName) assert.NoError(t, err, "DeleteNetworkSet err-> %s", err) testNetSet, err = c.GetNetworkSetByName(testName) assert.NoError(t, err, "GetNetworkSetByName with deleted network set-> %+v", err) assert.Equal(t, "", testNetSet.Name, fmt.Sprintf("Problem getting netset name, %+v", testNetSet)) } else { _, c = getTestDriverU("test_network_set") err := c.DeleteNetworkSet("footest") assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, testNetSet)) } }
func TestDeleteNetworkSetNotFound(t *testing.T) { var ( c *ov.OVClient testName = "fake" testNetSet ov.NetworkSet ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { _, c = getTestDriverA("test_network_set") if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } err := c.DeleteNetworkSet(testName) assert.NoError(t, err, "DeleteNetworkSet err-> %s", err) testNetSet, err = c.GetNetworkSetByName(testName) assert.NoError(t, err, "GetNetworkSetByName with deleted network set -> %+v", err) assert.Equal(t, "", testNetSet.Name, fmt.Sprintf("Problem getting network set wtih name, %+v", testNetSet)) } else { _, c = getTestDriverU("test_network_set") err := c.DeleteNetworkSet(testName) assert.Error(t, err, fmt.Sprintf("All ok, no error, caught as expected: %s,%+v\n", err, testNetSet)) } }