func TestCreateFCoENetwork(t *testing.T) { var ( d *OVTest c *ov.OVClient testName string ) if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" { d, c = getTestDriverA("test_fcoe_network") if c == nil { t.Fatalf("Failed to execute getTestDriver() ") } //find out if the test fcoe network already exists testName = d.Tc.GetTestData(d.Env, "Name").(string) testFcoeNet, err := c.GetFCoENetworkByName(testName) assert.NoError(t, err, "CreateFCoENetwork get the FCoENetwork error --> %s", err) if testFcoeNet.URI.IsNil() { testFcoeNet = ov.FCoENetwork{ Name: testName, VlanId: 143, Type: d.Tc.GetTestData(d.Env, "Type").(string), } err := c.CreateFCoENetwork(testFcoeNet) assert.NoError(t, err, "CreateFCoENetwork error --> %s", err) err = c.CreateFCoENetwork(testFcoeNet) assert.Error(t, err, "CreateFCoENetwork should error because FCoENetwork already exists, err --> %s ", err) } else { log.Warnf("The fcoeNetwork already exists, so skipping CreateFCoENetwork test for %s", testName) } //reload the profile we just created testFcoeNet, err = c.GetFCoENetworkByName(testName) assert.NoError(t, err, "GetFCoENetworks error --> %s", err) } }