Acceptance Test Updates (#218)
* compute: don't pass choices
* blockstorage: don't pass choices
* DumpResource Function
This function prints a resource in JSON format but retains the actual
field name rather than using the name specified in the JSON tag.
* New DumpResource
This version just converts the resource into JSON. The original is
being left in git history for posterity.
* Renaming DumpResource to PrintResource
* Removing all print functions in favor of PrintResource
* Rebase reconcilliation
diff --git a/acceptance/openstack/networking/v2/apiversion_test.go b/acceptance/openstack/networking/v2/apiversion_test.go
index 409550c..c6f8f26 100644
--- a/acceptance/openstack/networking/v2/apiversion_test.go
+++ b/acceptance/openstack/networking/v2/apiversion_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/apiversions"
)
@@ -26,7 +27,7 @@
}
for _, apiVersion := range allAPIVersions {
- PrintAPIVersion(t, &apiVersion)
+ tools.PrintResource(t, apiVersion)
}
}
@@ -47,6 +48,6 @@
}
for _, versionResource := range allVersionResources {
- PrintVersionResource(t, &versionResource)
+ tools.PrintResource(t, versionResource)
}
}
diff --git a/acceptance/openstack/networking/v2/extension_test.go b/acceptance/openstack/networking/v2/extension_test.go
index baade1e..5609e85 100644
--- a/acceptance/openstack/networking/v2/extension_test.go
+++ b/acceptance/openstack/networking/v2/extension_test.go
@@ -6,7 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
- "github.com/gophercloud/gophercloud/acceptance/openstack"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/common/extensions"
)
@@ -27,7 +27,7 @@
}
for _, extension := range allExtensions {
- openstack.PrintExtension(t, &extension)
+ tools.PrintResource(t, extension)
}
}
@@ -42,5 +42,5 @@
t.Fatalf("Unable to get extension port-security: %v", err)
}
- openstack.PrintExtension(t, extension)
+ tools.PrintResource(t, extension)
}
diff --git a/acceptance/openstack/networking/v2/extensions/extensions.go b/acceptance/openstack/networking/v2/extensions/extensions.go
index f18e430..154e34e 100644
--- a/acceptance/openstack/networking/v2/extensions/extensions.go
+++ b/acceptance/openstack/networking/v2/extensions/extensions.go
@@ -6,7 +6,6 @@
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/external"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/provider"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/rules"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
@@ -137,44 +136,3 @@
t.Fatalf("Unable to delete security group rule: %v", err)
}
}
-
-// PrintNetworkExtAttrs prints a network and all of its extra attributes.
-func PrintNetworkExtAttrs(t *testing.T, network *provider.NetworkExtAttrs) {
- t.Logf("ID: %s", network.ID)
- t.Logf("Name: %s", network.Name)
- t.Logf("AdminStateUp: %t", network.AdminStateUp)
- t.Logf("Status: %s", network.Status)
- t.Logf("Subnets: %s", network.Subnets)
- t.Logf("TenantID: %s", network.TenantID)
- t.Logf("Shared: %t", network.Shared)
- t.Logf("NetworkType: %s", network.NetworkType)
- t.Logf("PhysicalNetwork: %s", network.PhysicalNetwork)
- t.Logf("SegmentationID: %d", network.SegmentationID)
-}
-
-// PrintSecurityGroup will print a security group and all of its attributes.
-func PrintSecurityGroup(t *testing.T, secGroup *groups.SecGroup) {
- t.Logf("ID: %s", secGroup.ID)
- t.Logf("Name: %s", secGroup.Name)
- t.Logf("Description: %s", secGroup.Description)
- t.Logf("TenantID: %s", secGroup.TenantID)
- t.Logf("Rules:")
-
- for _, rule := range secGroup.Rules {
- PrintSecurityGroupRule(t, &rule)
- }
-}
-
-// PrintSecurityGroupRule will print a security group rule and all of its attributes.
-func PrintSecurityGroupRule(t *testing.T, rule *rules.SecGroupRule) {
- t.Logf("ID: %s", rule.ID)
- t.Logf("Direction: %s", rule.Direction)
- t.Logf("EtherType: %s", rule.EtherType)
- t.Logf("SecGroupID: %s", rule.SecGroupID)
- t.Logf("PortRangeMin: %d", rule.PortRangeMin)
- t.Logf("PortRangeMax: %d", rule.PortRangeMax)
- t.Logf("Protocol: %s", rule.Protocol)
- t.Logf("RemoteGroupID: %s", rule.RemoteGroupID)
- t.Logf("RemoteIPPrefix: %s", rule.RemoteIPPrefix)
- t.Logf("TenantID: %s", rule.TenantID)
-}
diff --git a/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go b/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go
index 0b021d3..473013b 100644
--- a/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go
+++ b/acceptance/openstack/networking/v2/extensions/fwaas/firewall_test.go
@@ -7,6 +7,7 @@
"github.com/gophercloud/gophercloud/acceptance/clients"
layer3 "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2/extensions/layer3"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/fwaas/routerinsertion"
)
@@ -28,7 +29,7 @@
}
for _, firewall := range allFirewalls {
- PrintFirewall(t, &firewall)
+ tools.PrintResource(t, firewall)
}
}
@@ -50,7 +51,7 @@
}
defer DeleteRule(t, client, rule.ID)
- PrintRule(t, rule)
+ tools.PrintResource(t, rule)
policy, err := CreatePolicy(t, client, rule.ID)
if err != nil {
@@ -58,7 +59,7 @@
}
defer DeletePolicy(t, client, policy.ID)
- PrintPolicy(t, policy)
+ tools.PrintResource(t, policy)
firewall, err := CreateFirewallOnRouter(t, client, policy.ID, router.ID)
if err != nil {
@@ -66,7 +67,7 @@
}
defer DeleteFirewall(t, client, firewall.ID)
- PrintFirewall(t, firewall)
+ tools.PrintResource(t, firewall)
router2, err := layer3.CreateExternalRouter(t, client)
if err != nil {
@@ -94,5 +95,5 @@
t.Fatalf("Unable to get firewall: %v", err)
}
- PrintFirewall(t, newFirewall)
+ tools.PrintResource(t, newFirewall)
}
diff --git a/acceptance/openstack/networking/v2/extensions/fwaas/fwaas.go b/acceptance/openstack/networking/v2/extensions/fwaas/fwaas.go
index dd361f9..204565b 100644
--- a/acceptance/openstack/networking/v2/extensions/fwaas/fwaas.go
+++ b/acceptance/openstack/networking/v2/extensions/fwaas/fwaas.go
@@ -20,9 +20,11 @@
t.Logf("Attempting to create firewall %s", firewallName)
+ iTrue := true
createOpts := firewalls.CreateOpts{
- Name: firewallName,
- PolicyID: policyID,
+ Name: firewallName,
+ PolicyID: policyID,
+ AdminStateUp: &iTrue,
}
firewall, err := firewalls.Create(client, createOpts).Extract()
@@ -177,49 +179,6 @@
t.Logf("Deleted rule: %s", ruleID)
}
-// PrintFirewall will print a firewall and all of its attributes.
-func PrintFirewall(t *testing.T, firewall *firewalls.Firewall) {
- t.Logf("ID: %s", firewall.ID)
- t.Logf("Name: %s", firewall.Name)
- t.Logf("Description: %s", firewall.Description)
- t.Logf("AdminStateUp: %t", firewall.AdminStateUp)
- t.Logf("Status: %s", firewall.Status)
- t.Logf("PolicyID: %s", firewall.PolicyID)
- t.Logf("TenantID: %s", firewall.TenantID)
-}
-
-// PrintPolicy will print a policy and all of its attributes.
-func PrintPolicy(t *testing.T, policy *policies.Policy) {
- t.Logf("ID: %s", policy.ID)
- t.Logf("Name: %s", policy.Name)
- t.Logf("Description: %s", policy.Description)
- t.Logf("TenantID: %s", policy.TenantID)
- t.Logf("Audited: %t", policy.Audited)
- t.Logf("Shared: %t", policy.Shared)
- t.Logf("Rules:")
-
- for _, rule := range policy.Rules {
- t.Logf("Rule ID: %s", rule)
- }
-}
-
-// PrintRule will print a rule and all of its attributes.
-func PrintRule(t *testing.T, rule *rules.Rule) {
- t.Logf("ID: %s", rule.ID)
- t.Logf("Name: %s", rule.Name)
- t.Logf("Description: %s", rule.Description)
- t.Logf("Protocol: %s", rule.Protocol)
- t.Logf("Action: %s", rule.Action)
- t.Logf("IPVersion: %d", rule.IPVersion)
- t.Logf("SourceIPAddress: %s", rule.SourceIPAddress)
- t.Logf("DestinationIPAddress: %s", rule.DestinationIPAddress)
- t.Logf("Shared: %t", rule.Shared)
- t.Logf("Enabled: %t", rule.Enabled)
- t.Logf("PolicyID: %s", rule.PolicyID)
- t.Logf("Position: %d", rule.Position)
- t.Logf("TenantID: %s", rule.TenantID)
-}
-
// WaitForFirewallState will wait until a firewall reaches a given state.
func WaitForFirewallState(client *gophercloud.ServiceClient, firewallID, status string, secs int) error {
return gophercloud.WaitFor(secs, func() (bool, error) {
diff --git a/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go b/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go
index 9003e54..3220d82 100644
--- a/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go
+++ b/acceptance/openstack/networking/v2/extensions/fwaas/policy_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/fwaas/policies"
)
@@ -26,7 +27,7 @@
}
for _, policy := range allPolicies {
- PrintPolicy(t, &policy)
+ tools.PrintResource(t, policy)
}
}
@@ -42,7 +43,7 @@
}
defer DeleteRule(t, client, rule.ID)
- PrintRule(t, rule)
+ tools.PrintResource(t, rule)
policy, err := CreatePolicy(t, client, rule.ID)
if err != nil {
@@ -50,7 +51,7 @@
}
defer DeletePolicy(t, client, policy.ID)
- PrintPolicy(t, policy)
+ tools.PrintResource(t, policy)
updateOpts := policies.UpdateOpts{
Description: "Some policy description",
@@ -66,5 +67,5 @@
t.Fatalf("Unable to get policy: %v", err)
}
- PrintPolicy(t, newPolicy)
+ tools.PrintResource(t, newPolicy)
}
diff --git a/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go b/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go
index c8e67dc..4521a60 100644
--- a/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go
+++ b/acceptance/openstack/networking/v2/extensions/fwaas/rule_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/fwaas/rules"
)
@@ -26,7 +27,7 @@
}
for _, rule := range allRules {
- PrintRule(t, &rule)
+ tools.PrintResource(t, rule)
}
}
@@ -42,7 +43,7 @@
}
defer DeleteRule(t, client, rule.ID)
- PrintRule(t, rule)
+ tools.PrintResource(t, rule)
ruleDescription := "Some rule description"
updateOpts := rules.UpdateOpts{
@@ -59,5 +60,5 @@
t.Fatalf("Unable to get rule: %v", err)
}
- PrintRule(t, newRule)
+ tools.PrintResource(t, newRule)
}
diff --git a/acceptance/openstack/networking/v2/extensions/layer3/floatingips_test.go b/acceptance/openstack/networking/v2/extensions/layer3/floatingips_test.go
index c20b0d1..952213e 100644
--- a/acceptance/openstack/networking/v2/extensions/layer3/floatingips_test.go
+++ b/acceptance/openstack/networking/v2/extensions/layer3/floatingips_test.go
@@ -7,6 +7,7 @@
"github.com/gophercloud/gophercloud/acceptance/clients"
networking "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips"
)
@@ -28,7 +29,7 @@
}
for _, fip := range allFIPs {
- PrintFloatingIP(t, &fip)
+ tools.PrintResource(t, fip)
}
}
@@ -77,7 +78,7 @@
t.Fatalf("Unable to get floating ip: %v", err)
}
- PrintFloatingIP(t, newFip)
+ tools.PrintResource(t, newFip)
// Disassociate the floating IP
updateOpts := floatingips.UpdateOpts{
diff --git a/acceptance/openstack/networking/v2/extensions/layer3/layer3.go b/acceptance/openstack/networking/v2/extensions/layer3/layer3.go
index 3d2d88f..7bc0676 100644
--- a/acceptance/openstack/networking/v2/extensions/layer3/layer3.go
+++ b/acceptance/openstack/networking/v2/extensions/layer3/layer3.go
@@ -177,42 +177,6 @@
t.Logf("Deleted floating IP: %s", floatingIPID)
}
-// PrintFloatingIP prints a floating IP and all of its attributes.
-func PrintFloatingIP(t *testing.T, fip *floatingips.FloatingIP) {
- t.Logf("ID: %s", fip.ID)
- t.Logf("FloatingNetworkID: %s", fip.FloatingNetworkID)
- t.Logf("FloatingIP: %s", fip.FloatingIP)
- t.Logf("PortID: %s", fip.PortID)
- t.Logf("FixedIP: %s", fip.FixedIP)
- t.Logf("TenantID: %s", fip.TenantID)
- t.Logf("Status: %s", fip.Status)
-}
-
-// PrintRouterInterface prints a router interface and all of its attributes.
-func PrintRouterInterface(t *testing.T, routerInterface *routers.InterfaceInfo) {
- t.Logf("ID: %s", routerInterface.ID)
- t.Logf("SubnetID: %s", routerInterface.SubnetID)
- t.Logf("PortID: %s", routerInterface.PortID)
- t.Logf("TenantID: %s", routerInterface.TenantID)
-}
-
-// PrintRouter prints a router and all of its attributes.
-func PrintRouter(t *testing.T, router *routers.Router) {
- t.Logf("ID: %s", router.ID)
- t.Logf("Status: %s", router.Status)
- t.Logf("GatewayInfo: %s", router.GatewayInfo)
- t.Logf("AdminStateUp: %t", router.AdminStateUp)
- t.Logf("Distributed: %t", router.Distributed)
- t.Logf("Name: %s", router.Name)
- t.Logf("TenantID: %s", router.TenantID)
- t.Logf("Routes:")
-
- for _, route := range router.Routes {
- t.Logf("\tNextHop: %s", route.NextHop)
- t.Logf("\tDestinationCIDR: %s", route.DestinationCIDR)
- }
-}
-
func WaitForRouterToCreate(client *gophercloud.ServiceClient, routerID string, secs int) error {
return gophercloud.WaitFor(secs, func() (bool, error) {
r, err := routers.Get(client, routerID).Extract()
diff --git a/acceptance/openstack/networking/v2/extensions/layer3/routers_test.go b/acceptance/openstack/networking/v2/extensions/layer3/routers_test.go
index 67688ec..e0be169 100644
--- a/acceptance/openstack/networking/v2/extensions/layer3/routers_test.go
+++ b/acceptance/openstack/networking/v2/extensions/layer3/routers_test.go
@@ -29,7 +29,7 @@
}
for _, router := range allRouters {
- PrintRouter(t, &router)
+ tools.PrintResource(t, router)
}
}
@@ -45,7 +45,7 @@
}
defer DeleteRouter(t, client, router.ID)
- PrintRouter(t, router)
+ tools.PrintResource(t, router)
newName := tools.RandomString("TESTACC-", 8)
updateOpts := routers.UpdateOpts{
@@ -62,7 +62,7 @@
t.Fatalf("Unable to get router: %v", err)
}
- PrintRouter(t, newRouter)
+ tools.PrintResource(t, newRouter)
}
func TestLayer3RouterInterface(t *testing.T) {
@@ -82,7 +82,7 @@
}
defer networking.DeleteSubnet(t, client, subnet.ID)
- networking.PrintSubnet(t, subnet)
+ tools.PrintResource(t, subnet)
router, err := CreateExternalRouter(t, client)
if err != nil {
@@ -99,8 +99,8 @@
t.Fatalf("Failed to add interface to router: %v", err)
}
- PrintRouter(t, router)
- PrintRouterInterface(t, iface)
+ tools.PrintResource(t, router)
+ tools.PrintResource(t, iface)
riOpts := routers.RemoveInterfaceOpts{
SubnetID: subnet.ID,
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/lbaas.go b/acceptance/openstack/networking/v2/extensions/lbaas/lbaas.go
index 32bfcd4..1f7b2b0 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/lbaas.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/lbaas.go
@@ -158,63 +158,3 @@
t.Logf("Successfully deleted vip %s", vipID)
}
-
-// PrintMember will print a member and all of its attributes.
-func PrintMember(t *testing.T, member *members.Member) {
- t.Logf("ID: %s", member.ID)
- t.Logf("TenantID: %s", member.TenantID)
- t.Logf("Status: %s", member.Status)
- t.Logf("Weight: %d", member.Weight)
- t.Logf("AdminStateUp: %t", member.AdminStateUp)
- t.Logf("PoolID: %s", member.PoolID)
- t.Logf("Address: %s", member.Address)
- t.Logf("ProtocolPort: %s", member.ProtocolPort)
-}
-
-// PrintMonitor will print a monitor and all of its attributes.
-func PrintMonitor(t *testing.T, monitor *monitors.Monitor) {
- t.Logf("ID: %s", monitor.ID)
- t.Logf("Name: %s", monitor.Name)
- t.Logf("TenantID: %s", monitor.TenantID)
- t.Logf("Status: %s", monitor.Status)
- t.Logf("Type: %s", monitor.Type)
- t.Logf("Delay: %d", monitor.Delay)
- t.Logf("Timeout: %d", monitor.Timeout)
- t.Logf("MaxRetries: %d", monitor.MaxRetries)
- t.Logf("HTTPMethod: %s", monitor.HTTPMethod)
- t.Logf("URLPath: %s", monitor.URLPath)
- t.Logf("ExpectedCodes: %s", monitor.ExpectedCodes)
- t.Logf("AdminStateUp: %t", monitor.AdminStateUp)
-}
-
-// PrintPool will print a pool and all of its attributes.
-func PrintPool(t *testing.T, pool *pools.Pool) {
- t.Logf("ID: %s", pool.ID)
- t.Logf("Name: %s", pool.Name)
- t.Logf("TenantID: %s", pool.TenantID)
- t.Logf("Status: %s", pool.Status)
- t.Logf("LBMethod: %s", pool.LBMethod)
- t.Logf("Description: %s", pool.Description)
- t.Logf("SubnetID: %s", pool.SubnetID)
- t.Logf("AdminStateUp: %t", pool.AdminStateUp)
- t.Logf("MonitorIDs: %s", pool.MonitorIDs)
- t.Logf("MemberIDs: %s", pool.MemberIDs)
-}
-
-// PrintVIP will print a vip and all of its attributes.
-func PrintVIP(t *testing.T, vip *vips.VirtualIP) {
- t.Logf("ID: %s", vip.ID)
- t.Logf("Name: %s", vip.Name)
- t.Logf("TenantID: %s", vip.TenantID)
- t.Logf("Status: %s", vip.Status)
- t.Logf("Description: %s", vip.Description)
- t.Logf("SubnetID: %s", vip.SubnetID)
- t.Logf("Address: %s", vip.Address)
- t.Logf("Protocol: %s", vip.Protocol)
- t.Logf("ProtocolPort: %d", vip.ProtocolPort)
- t.Logf("PoolID: %s", vip.PoolID)
- t.Logf("PortID: %s", vip.PortID)
- t.Logf("Persistence: %s", vip.Persistence)
- t.Logf("ConnLimit: %d", vip.ConnLimit)
- t.Logf("AdminStateUp: %t", vip.AdminStateUp)
-}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/members_test.go b/acceptance/openstack/networking/v2/extensions/lbaas/members_test.go
index 004036e..75dec83 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/members_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/members_test.go
@@ -8,6 +8,7 @@
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/acceptance/clients"
networking "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas/members"
)
@@ -28,7 +29,7 @@
}
for _, member := range allMembers {
- PrintMember(t, &member)
+ tools.PrintResource(t, member)
}
}
@@ -62,7 +63,7 @@
}
defer DeleteMember(t, client, member.ID)
- PrintMember(t, member)
+ tools.PrintResource(t, member)
updateOpts := members.UpdateOpts{
AdminStateUp: gophercloud.Enabled,
@@ -78,5 +79,5 @@
t.Fatalf("Unable to get member: %v")
}
- PrintMember(t, newMember)
+ tools.PrintResource(t, newMember)
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/monitors_test.go b/acceptance/openstack/networking/v2/extensions/lbaas/monitors_test.go
index e9a7dbb..56b413a 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/monitors_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/monitors_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas/monitors"
)
@@ -26,7 +27,7 @@
}
for _, monitor := range allMonitors {
- PrintMonitor(t, &monitor)
+ tools.PrintResource(t, monitor)
}
}
@@ -42,7 +43,7 @@
}
defer DeleteMonitor(t, client, monitor.ID)
- PrintMonitor(t, monitor)
+ tools.PrintResource(t, monitor)
updateOpts := monitors.UpdateOpts{
Delay: 999,
@@ -58,5 +59,5 @@
t.Fatalf("Unable to get monitor: %v")
}
- PrintMonitor(t, newMonitor)
+ tools.PrintResource(t, newMonitor)
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/pools_test.go b/acceptance/openstack/networking/v2/extensions/lbaas/pools_test.go
index 8af4d19..b53237c 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/pools_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/pools_test.go
@@ -7,6 +7,7 @@
"github.com/gophercloud/gophercloud/acceptance/clients"
networking "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas/pools"
)
@@ -27,7 +28,7 @@
}
for _, pool := range allPools {
- PrintPool(t, &pool)
+ tools.PrintResource(t, pool)
}
}
@@ -55,7 +56,7 @@
}
defer DeletePool(t, client, pool.ID)
- PrintPool(t, pool)
+ tools.PrintResource(t, pool)
updateOpts := pools.UpdateOpts{
LBMethod: pools.LBMethodLeastConnections,
@@ -71,7 +72,7 @@
t.Fatalf("Unable to get pool: %v")
}
- PrintPool(t, newPool)
+ tools.PrintResource(t, newPool)
}
func TestPoolsMonitors(t *testing.T) {
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/vips_test.go b/acceptance/openstack/networking/v2/extensions/lbaas/vips_test.go
index 1f61b36..ba3f9b4 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/vips_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/vips_test.go
@@ -27,7 +27,7 @@
}
for _, vip := range allVIPs {
- PrintVIP(t, &vip)
+ tools.PrintResource(t, vip)
}
}
@@ -61,7 +61,7 @@
}
defer DeleteVIP(t, client, vip.ID)
- PrintVIP(t, vip)
+ tools.PrintResource(t, vip)
connLimit := 100
updateOpts := vips.UpdateOpts{
@@ -78,5 +78,5 @@
t.Fatalf("Unable to get vip: %v")
}
- PrintVIP(t, newVIP)
+ tools.PrintResource(t, newVIP)
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas_v2/lbaas_v2.go b/acceptance/openstack/networking/v2/extensions/lbaas_v2/lbaas_v2.go
index d2e7195..093f835 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas_v2/lbaas_v2.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas_v2/lbaas_v2.go
@@ -258,116 +258,6 @@
t.Logf("Successfully deleted pool %s", poolID)
}
-// PrintListener will print a listener and all of its attributes.
-func PrintListener(t *testing.T, listener *listeners.Listener) {
- t.Logf("ID: %s", listener.ID)
- t.Logf("TenantID: %s", listener.TenantID)
- t.Logf("Name: %s", listener.Name)
- t.Logf("Description: %s", listener.Description)
- t.Logf("Protocol: %s", listener.Protocol)
- t.Logf("DefaultPoolID: %s", listener.DefaultPoolID)
- t.Logf("ConnLimit: %d", listener.ConnLimit)
- t.Logf("SniContainerRefs: %s", listener.SniContainerRefs)
- t.Logf("DefaultTlsContainerRef: %s", listener.DefaultTlsContainerRef)
- t.Logf("AdminStateUp: %t", listener.AdminStateUp)
-
- t.Logf("Pools:")
- for _, pool := range listener.Pools {
- t.Logf("\t%#v", pool)
- }
-
- t.Logf("LoadBalancers")
- for _, lb := range listener.Loadbalancers {
- t.Logf("\t%#v", lb)
- }
-}
-
-// PrintLoadBalancer will print a load balancer and all of its attributes.
-func PrintLoadBalancer(t *testing.T, lb *loadbalancers.LoadBalancer) {
- t.Logf("ID: %s", lb.ID)
- t.Logf("Name: %s", lb.Name)
- t.Logf("TenantID: %s", lb.TenantID)
- t.Logf("Description: %s", lb.Description)
- t.Logf("ProvisioningStatus: %s", lb.ProvisioningStatus)
- t.Logf("VipAddress: %s", lb.VipAddress)
- t.Logf("VipPortID: %s", lb.VipPortID)
- t.Logf("VipSubnetID: %s", lb.VipSubnetID)
- t.Logf("OperatingStatus: %s", lb.OperatingStatus)
- t.Logf("Flavor: %s", lb.Flavor)
- t.Logf("Provider: %s", lb.Provider)
- t.Logf("AdminStateUp: %t", lb.AdminStateUp)
-
- t.Logf("Listeners")
- for _, listener := range lb.Listeners {
- t.Logf("\t%#v", listener)
- }
-}
-
-// PrintMember will print a member and all of its attributes.
-func PrintMember(t *testing.T, member *pools.Member) {
- t.Logf("ID: %s", member.ID)
- t.Logf("Name: %s", member.Name)
- t.Logf("TenantID: %s", member.TenantID)
- t.Logf("Weight: %d", member.Weight)
- t.Logf("SubnetID: %s", member.SubnetID)
- t.Logf("PoolID: %s", member.PoolID)
- t.Logf("Address: %s", member.Address)
- t.Logf("ProtocolPort: %d", member.ProtocolPort)
- t.Logf("AdminStateUp: %t", member.AdminStateUp)
-}
-
-// PrintMonitor will print a monitor and all of its attributes.
-func PrintMonitor(t *testing.T, monitor *monitors.Monitor) {
- t.Logf("ID: %s", monitor.ID)
- t.Logf("Name: %s", monitor.Name)
- t.Logf("TenantID: %s", monitor.TenantID)
- t.Logf("Type: %s", monitor.Type)
- t.Logf("Delay: %d", monitor.Delay)
- t.Logf("Timeout: %d", monitor.Timeout)
- t.Logf("MaxRetries: %d", monitor.MaxRetries)
- t.Logf("HTTPMethod: %s", monitor.HTTPMethod)
- t.Logf("URLPath: %s", monitor.URLPath)
- t.Logf("ExpectedCodes: %s", monitor.ExpectedCodes)
- t.Logf("AdminStateUp: %t", monitor.AdminStateUp)
- t.Logf("Status: %s", monitor.Status)
-
- t.Logf("Pools")
- for _, pool := range monitor.Pools {
- t.Logf("\t%#v", pool)
- }
-}
-
-// PrintPool will print a pool and all of its attributes.
-func PrintPool(t *testing.T, pool *pools.Pool) {
- t.Logf("ID: %s", pool.ID)
- t.Logf("Name: %s", pool.Name)
- t.Logf("TenantID: %s", pool.TenantID)
- t.Logf("Description: %s", pool.Description)
- t.Logf("LBMethod: %s", pool.LBMethod)
- t.Logf("Protocol: %s", pool.Protocol)
- t.Logf("MonitorID: %s", pool.MonitorID)
- t.Logf("SubnetID: %s", pool.SubnetID)
- t.Logf("AdminStateUp: %t", pool.AdminStateUp)
- t.Logf("Persistence: %s", pool.Persistence)
- t.Logf("Provider: %s", pool.Provider)
- t.Logf("Monitor: %#v", pool.Monitor)
-
- t.Logf("Listeners")
- for _, listener := range pool.Listeners {
- t.Logf("\t%#v", listener)
- }
-
- t.Logf("Members")
- for _, member := range pool.Members {
- t.Logf("\t%#v", member)
- }
-
- t.Logf("Loadbalancers")
- for _, lb := range pool.Loadbalancers {
- t.Logf("\t%#v", lb)
- }
-}
-
// WaitForLoadBalancerState will wait until a loadbalancer reaches a given state.
func WaitForLoadBalancerState(client *gophercloud.ServiceClient, lbID, status string, secs int) error {
return gophercloud.WaitFor(secs, func() (bool, error) {
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas_v2/listeners_test.go b/acceptance/openstack/networking/v2/extensions/lbaas_v2/listeners_test.go
index ac2681e..2d2dd03 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas_v2/listeners_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas_v2/listeners_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/listeners"
)
@@ -26,6 +27,6 @@
}
for _, listener := range allListeners {
- PrintListener(t, &listener)
+ tools.PrintResource(t, listener)
}
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas_v2/loadbalancers_test.go b/acceptance/openstack/networking/v2/extensions/lbaas_v2/loadbalancers_test.go
index 7cd49ed..650eb2c 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas_v2/loadbalancers_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas_v2/loadbalancers_test.go
@@ -31,7 +31,7 @@
}
for _, lb := range allLoadbalancers {
- PrintLoadBalancer(t, &lb)
+ tools.PrintResource(t, lb)
}
}
@@ -64,7 +64,7 @@
t.Fatalf("Unable to get loadbalancer: %v", err)
}
- PrintLoadBalancer(t, newLB)
+ tools.PrintResource(t, newLB)
// Because of the time it takes to create a loadbalancer,
// this test will include some other resources.
@@ -93,7 +93,7 @@
t.Fatalf("Unable to get listener")
}
- PrintListener(t, newListener)
+ tools.PrintResource(t, newListener)
// Pool
pool, err := CreatePool(t, client, lb)
@@ -119,7 +119,7 @@
t.Fatalf("Unable to get pool")
}
- PrintPool(t, newPool)
+ tools.PrintResource(t, newPool)
// Member
member, err := CreateMember(t, client, lb, newPool, subnet.ID, subnet.CIDR)
@@ -146,7 +146,7 @@
t.Fatalf("Unable to get member")
}
- PrintMember(t, newMember)
+ tools.PrintResource(t, newMember)
// Monitor
monitor, err := CreateMonitor(t, client, lb, newPool)
@@ -173,6 +173,6 @@
t.Fatalf("Unable to get monitor")
}
- PrintMonitor(t, newMonitor)
+ tools.PrintResource(t, newMonitor)
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas_v2/monitors_test.go b/acceptance/openstack/networking/v2/extensions/lbaas_v2/monitors_test.go
index 2e587d9..b312370 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas_v2/monitors_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas_v2/monitors_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/monitors"
)
@@ -26,6 +27,6 @@
}
for _, monitor := range allMonitors {
- PrintMonitor(t, &monitor)
+ tools.PrintResource(t, monitor)
}
}
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas_v2/pools_test.go b/acceptance/openstack/networking/v2/extensions/lbaas_v2/pools_test.go
index 42ba5a2..b4f55a0 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas_v2/pools_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas_v2/pools_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/pools"
)
@@ -26,6 +27,6 @@
}
for _, pool := range allPools {
- PrintPool(t, &pool)
+ tools.PrintResource(t, pool)
}
}
diff --git a/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding.go b/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding.go
index b52cd80..a6d75f3 100644
--- a/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding.go
+++ b/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding.go
@@ -36,22 +36,3 @@
return port, nil
}
-
-// PrintPortsbinging will print a port and all of its attributes.
-func PrintPortsbinding(t *testing.T, port *portsbinding.Port) {
- t.Logf("ID: %s", port.ID)
- t.Logf("NetworkID: %s", port.NetworkID)
- t.Logf("Name: %s", port.Name)
- t.Logf("AdminStateUp: %t", port.AdminStateUp)
- t.Logf("Status: %s", port.Status)
- t.Logf("MACAddress: %s", port.MACAddress)
- t.Logf("FixedIPs: %s", port.FixedIPs)
- t.Logf("TenantID: %s", port.TenantID)
- t.Logf("DeviceOwner: %s", port.DeviceOwner)
- t.Logf("SecurityGroups: %s", port.SecurityGroups)
- t.Logf("DeviceID: %s", port.DeviceID)
- t.Logf("DeviceOwner: %s", port.DeviceOwner)
- t.Logf("AllowedAddressPairs: %s", port.AllowedAddressPairs)
- t.Logf("HostID: %s", port.HostID)
- t.Logf("VNICType: %s", port.VNICType)
-}
diff --git a/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding_test.go b/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding_test.go
index 2f2f618..803f62a 100644
--- a/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding_test.go
+++ b/acceptance/openstack/networking/v2/extensions/portsbinding/portsbinding_test.go
@@ -42,7 +42,7 @@
}
defer networking.DeletePort(t, client, port.ID)
- PrintPortsbinding(t, port)
+ tools.PrintResource(t, port)
// Update port
newPortName := tools.RandomString("TESTACC-", 8)
@@ -54,5 +54,5 @@
t.Fatalf("Could not update port: %v", err)
}
- PrintPortsbinding(t, newPort)
+ tools.PrintResource(t, newPort)
}
diff --git a/acceptance/openstack/networking/v2/extensions/provider_test.go b/acceptance/openstack/networking/v2/extensions/provider_test.go
index 8136581..b0d5846 100644
--- a/acceptance/openstack/networking/v2/extensions/provider_test.go
+++ b/acceptance/openstack/networking/v2/extensions/provider_test.go
@@ -7,6 +7,7 @@
"github.com/gophercloud/gophercloud/acceptance/clients"
networking "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/provider"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
)
@@ -30,5 +31,5 @@
t.Fatalf("Unable to extract network: %v", err)
}
- PrintNetworkExtAttrs(t, newNetwork)
+ tools.PrintResource(t, newNetwork)
}
diff --git a/acceptance/openstack/networking/v2/extensions/security_test.go b/acceptance/openstack/networking/v2/extensions/security_test.go
index 88003e7..c696377 100644
--- a/acceptance/openstack/networking/v2/extensions/security_test.go
+++ b/acceptance/openstack/networking/v2/extensions/security_test.go
@@ -7,6 +7,7 @@
"github.com/gophercloud/gophercloud/acceptance/clients"
networking "github.com/gophercloud/gophercloud/acceptance/openstack/networking/v2"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups"
)
@@ -28,7 +29,7 @@
}
for _, group := range allGroups {
- PrintSecurityGroup(t, &group)
+ tools.PrintResource(t, group)
}
}
@@ -50,7 +51,7 @@
}
defer DeleteSecurityGroupRule(t, client, rule.ID)
- PrintSecurityGroup(t, group)
+ tools.PrintResource(t, group)
}
func TestSecurityGroupsPort(t *testing.T) {
@@ -89,5 +90,5 @@
}
defer networking.DeletePort(t, client, port.ID)
- networking.PrintPort(t, port)
+ tools.PrintResource(t, port)
}
diff --git a/acceptance/openstack/networking/v2/networking.go b/acceptance/openstack/networking/v2/networking.go
index cc5befb..c5e7ca2 100644
--- a/acceptance/openstack/networking/v2/networking.go
+++ b/acceptance/openstack/networking/v2/networking.go
@@ -6,7 +6,6 @@
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/acceptance/tools"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/apiversions"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
@@ -196,61 +195,6 @@
t.Logf("Deleted subnet: %s", subnetID)
}
-// PrintAPIVersion will print an API version and all of its attributes.
-func PrintAPIVersion(t *testing.T, apiVersion *apiversions.APIVersion) {
- t.Logf("ID: %s", apiVersion.ID)
- t.Logf("Status: %s", apiVersion.Status)
-}
-
-// PrintNetwork will print a network and all of its attributes.
-func PrintNetwork(t *testing.T, network *networks.Network) {
- t.Logf("ID: %s", network.ID)
- t.Logf("Name: %s", network.Name)
- t.Logf("AdminStateUp: %t", network.AdminStateUp)
- t.Logf("Status: %s", network.Status)
- t.Logf("TenantID: %s", network.TenantID)
- t.Logf("Shared: %t", network.Shared)
- t.Logf("Subnets: %s", network.Subnets)
-}
-
-// PrintPort will print a port and all of its attributes.
-func PrintPort(t *testing.T, port *ports.Port) {
- t.Logf("ID: %s", port.ID)
- t.Logf("NetworkID: %s", port.NetworkID)
- t.Logf("Name: %s", port.Name)
- t.Logf("AdminStateUp: %t", port.AdminStateUp)
- t.Logf("Status: %s", port.Status)
- t.Logf("MACAddress: %s", port.MACAddress)
- t.Logf("FixedIPs: %s", port.FixedIPs)
- t.Logf("TenantID: %s", port.TenantID)
- t.Logf("DeviceOwner: %s", port.DeviceOwner)
- t.Logf("SecurityGroups: %s", port.SecurityGroups)
- t.Logf("DeviceID: %s", port.DeviceID)
- t.Logf("DeviceOwner: %s", port.DeviceOwner)
- t.Logf("AllowedAddressPairs: %s", port.AllowedAddressPairs)
-}
-
-// PrintSubnet will print a subnet and all of its attributes.
-func PrintSubnet(t *testing.T, subnet *subnets.Subnet) {
- t.Logf("ID: %s", subnet.ID)
- t.Logf("NetworkID: %s", subnet.NetworkID)
- t.Logf("Name: %s", subnet.Name)
- t.Logf("IPVersion: %d", subnet.IPVersion)
- t.Logf("CIDR: %s", subnet.CIDR)
- t.Logf("GatewayIP: %s", subnet.GatewayIP)
- t.Logf("DNSNameservers: %s", subnet.DNSNameservers)
- t.Logf("AllocationPools: %s", subnet.AllocationPools)
- t.Logf("HostRoutes: %s", subnet.HostRoutes)
- t.Logf("EnableDHCP: %t", subnet.EnableDHCP)
- t.Logf("TenantID: %s", subnet.TenantID)
-}
-
-// PrintVersionResource will print an API version resource and all of its attributes.
-func PrintVersionResource(t *testing.T, versionResource *apiversions.APIVersionResource) {
- t.Logf("Name: %s", versionResource.Name)
- t.Logf("Collection: %s", versionResource.Collection)
-}
-
func WaitForPortToCreate(client *gophercloud.ServiceClient, portID string, secs int) error {
return gophercloud.WaitFor(secs, func() (bool, error) {
p, err := ports.Get(client, portID).Extract()
diff --git a/acceptance/openstack/networking/v2/networks_test.go b/acceptance/openstack/networking/v2/networks_test.go
index a095079..66f42f8 100644
--- a/acceptance/openstack/networking/v2/networks_test.go
+++ b/acceptance/openstack/networking/v2/networks_test.go
@@ -27,7 +27,7 @@
}
for _, network := range allNetworks {
- PrintNetwork(t, &network)
+ tools.PrintResource(t, network)
}
}
@@ -44,7 +44,7 @@
}
defer DeleteNetwork(t, client, network.ID)
- PrintNetwork(t, network)
+ tools.PrintResource(t, network)
newName := tools.RandomString("TESTACC-", 8)
updateOpts := &networks.UpdateOpts{
@@ -61,5 +61,5 @@
t.Fatalf("Unable to retrieve network: %v", err)
}
- PrintNetwork(t, newNetwork)
+ tools.PrintResource(t, newNetwork)
}
diff --git a/acceptance/openstack/networking/v2/ports_test.go b/acceptance/openstack/networking/v2/ports_test.go
index b3b9ecb..fa1b4a4 100644
--- a/acceptance/openstack/networking/v2/ports_test.go
+++ b/acceptance/openstack/networking/v2/ports_test.go
@@ -27,7 +27,7 @@
}
for _, port := range allPorts {
- PrintPort(t, &port)
+ tools.PrintResource(t, port)
}
}
@@ -58,7 +58,7 @@
}
defer DeletePort(t, client, port.ID)
- PrintPort(t, port)
+ tools.PrintResource(t, port)
// Update port
newPortName := tools.RandomString("TESTACC-", 8)
@@ -70,5 +70,5 @@
t.Fatalf("Could not update port: %v", err)
}
- PrintPort(t, newPort)
+ tools.PrintResource(t, newPort)
}
diff --git a/acceptance/openstack/networking/v2/subnets_test.go b/acceptance/openstack/networking/v2/subnets_test.go
index 1d7696c..fd50a1f 100644
--- a/acceptance/openstack/networking/v2/subnets_test.go
+++ b/acceptance/openstack/networking/v2/subnets_test.go
@@ -29,7 +29,7 @@
}
for _, subnet := range allSubnets {
- PrintSubnet(t, &subnet)
+ tools.PrintResource(t, subnet)
}
}
@@ -53,7 +53,7 @@
}
defer DeleteSubnet(t, client, subnet.ID)
- PrintSubnet(t, subnet)
+ tools.PrintResource(t, subnet)
// Update Subnet
newSubnetName := tools.RandomString("TESTACC-", 8)
@@ -71,7 +71,7 @@
t.Fatalf("Unable to get subnet: %v", err)
}
- PrintSubnet(t, newSubnet)
+ tools.PrintResource(t, newSubnet)
}
func TestSubnetsDefaultGateway(t *testing.T) {
@@ -94,7 +94,7 @@
}
defer DeleteSubnet(t, client, subnet.ID)
- PrintSubnet(t, subnet)
+ tools.PrintResource(t, subnet)
if subnet.GatewayIP == "" {
t.Fatalf("A default gateway was not created.")
@@ -135,7 +135,7 @@
}
defer DeleteSubnet(t, client, subnet.ID)
- PrintSubnet(t, subnet)
+ tools.PrintResource(t, subnet)
if subnet.GatewayIP != "" {
t.Fatalf("A gateway exists when it shouldn't.")