testing

package
v0.3.42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

instances unit tests

Index

Constants

View Source
const AssignSecurityGroupsRequest = `
{
  "name": "Test"
}
`
View Source
const AttachInterfaceRequest = `
{
  "type": "subnet",
  "subnet_id": "9bc36cf6-407c-4a74-bc83-ce3aa3854c3d"
}
`
View Source
const CreateRequest = `` /* 636-byte string literal not displayed */
View Source
const CreateResponse = `
{
  "tasks": [
    "50f53a35-42ed-40c4-82b2-5a37fb3e00bc"
  ]
}
`
View Source
const DeleteResponse = `
{
  "tasks": [
    "50f53a35-42ed-40c4-82b2-5a37fb3e00bc"
  ]
}
`
View Source
const DetachInterfaceRequest = `
{
  "ip_address": "192.168.0.23",
  "port_id": "9bc36cf6-407c-4a74-bc83-ce3aa3854c3d"
}
`
View Source
const GetResponse = `` /* 1409-byte string literal not displayed */
View Source
const InterfacesResponse = `` /* 3142-byte string literal not displayed */
View Source
const ListResponse = `` /* 1683-byte string literal not displayed */
View Source
const MetadataCreateRequest = `
{
"test1": "test1", 
"test2": "test2"
}
`
View Source
const MetadataListResponse = `` /* 215-byte string literal not displayed */
View Source
const MetadataResponse = `
{
  "key": "cost-center",
  "value": "Atlanta",
  "read_only": false
}
`
View Source
const ResizeResponse = `
{
  "tasks": [
    "50f53a35-42ed-40c4-82b2-5a37fb3e00bc"
  ]
}
`
View Source
const SecurityGroupsListResponse = `
{
  "count": 1,
  "results": [
    {
      "name": "Test",
      "id": "2bf3a5d7-9072-40aa-8ac0-a64e39427a2c"
    }
  ]
}
`
View Source
const UnAssignSecurityGroupsRequest = `
{
  "name": "Test"
}
`

Variables

View Source
var (
	Instance1 = instances.Instance{
		ID:               instanceID,
		Name:             instanceName,
		Description:      instanceDescription,
		CreatedAt:        createdTime,
		Status:           "ACTIVE",
		VMState:          "active",
		TaskState:        nil,
		AvailabilityZone: instances.DefaultAvailabilityZone,
		Flavor: flavors.Flavor{
			FlavorID:   "g1s-shared-1-0.5",
			FlavorName: "g1s-shared-1-0.5",
			RAM:        512,
			VCPUS:      1,
		},
		Metadata: map[string]interface{}{
			"os_distro":     "centos",
			"os_version":    "1711-x64",
			"image_name":    "cirros-0.3.5-x86_64-disk",
			"image_id":      "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1",
			"snapshot_name": "test_snapshot",
			"snapshot_id":   "c286cd13-fba9-4302-9cdb-4351a05a56ea",
			"task_id":       "d1e1500b-e2be-40aa-9a4b-cc493fa1af30",
		},
		Volumes: []instances.InstanceVolume{{
			ID:                  "28bfe198-a003-4283-8dca-ab5da4a71b62",
			DeleteOnTermination: false,
		}},
		Addresses: map[string][]instances.InstanceAddress{
			"net1": {{
				Type:    types.AddressTypeFixed,
				Address: ip1,
			},
				{
					Type:    types.AddressTypeFloating,
					Address: ip2,
				},
			},
			"net2": {{
				Type:    types.AddressTypeFixed,
				Address: ip3,
			}},
		},
		SecurityGroups: []gcorecloud.ItemName{{
			Name: "default",
		}},
		CreatorTaskID: &creatorTaskID,
		TaskID:        &taskID,
		ProjectID:     1,
		RegionID:      1,
		Region:        "RegionOne",
	}
	PortID                         = "1f0ca628-a73b-42c0-bdac-7b10d023e097"
	PortMac, _                     = gcorecloud.ParseMacString("00:16:3e:f2:87:16")
	PortIP1                        = net.ParseIP("192.168.123.20")
	PortIP2                        = net.ParseIP("192.168.120.16")
	PortNetworkUpdatedAt, _        = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:44:44+0000")
	PortNetworkCreatedAt, _        = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:44:08+0000")
	PortNetworkSubnet1CreatedAt, _ = time.Parse(gcorecloud.RFC3339Z, "2019-07-18T12:07:00+0000")
	PortNetworkSubnet1UpdatedAt, _ = time.Parse(gcorecloud.RFC3339Z, "2019-07-22T10:55:45+0000")
	PortNetworkSubnet2CreatedAt, _ = time.Parse(gcorecloud.RFC3339Z, "2019-07-22T15:15:05+0000")
	PortNetworkSubnet2UpdatedAt, _ = time.Parse(gcorecloud.RFC3339Z, "2019-07-22T15:15:05+0000")
	PortNetworkSubnet1Cidr, _      = gcorecloud.ParseCIDRString("192.168.123.0/24")
	PortNetworkSubnet2Cidr, _      = gcorecloud.ParseCIDRString("192.168.120.0/24")
	FloatingIP1                    = net.ParseIP("5.188.135.29")
	FixedIP1                       = net.ParseIP("192.168.123.20")
	FloatingIP2                    = net.ParseIP("5.188.135.30")
	FixedIP2                       = net.ParseIP("192.168.120.16")
	PortFloatingIP1CreatedAt, _    = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:47:19+0000")
	PortFloatingIP1UpdatedAt, _    = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:47:23+0000")
	PortFloatingIP1CreatorTaskID   = "d1c1fd65-6eef-4e64-96cb-705cbbdbc90b"
	PortFloatingIP2CreatedAt, _    = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:47:18+0000")
	PortFloatingIP2UpdatedAt, _    = time.Parse(gcorecloud.RFC3339Z, "2020-02-26T08:47:23+0000")
	PortFloatingIP2CreatorTaskID   = "d1c1fd65-6eef-4e64-96cb-705cbbdbc90b"
	NetworkDetailsCreatorTask      = "a10dd116-07f5-4225-abb7-f42da5cb78fb"
	NetworkDetailsTask             = "a10dd116-07f5-4225-abb7-f42da5cb78fc"
	SecurityGroup1                 = gcorecloud.ItemIDName{
		ID:   "2bf3a5d7-9072-40aa-8ac0-a64e39427a2c",
		Name: "Test",
	}
	InstanceInterface1 = instances.Interface{
		PortID:              PortID,
		MacAddress:          *PortMac,
		PortSecurityEnabled: true,
		NetworkID:           "bc688791-f1b0-44eb-97d4-07697294b1e1",
		IPAssignments: []instances.PortIP{{
			IPAddress: PortIP1,
			SubnetID:  "351b0dd7-ca09-431c-be53-935db3785067",
		}, {
			IPAddress: PortIP2,
			SubnetID:  "0a641ef8-62dc-4146-91e5-6ab4b464df6d",
		}},
		NetworkDetails: instances.NetworkDetail{
			Mtu:           1450,
			UpdatedAt:     &gcorecloud.JSONRFC3339Z{Time: PortNetworkUpdatedAt},
			CreatedAt:     gcorecloud.JSONRFC3339Z{Time: PortNetworkCreatedAt},
			ID:            "bc688791-f1b0-44eb-97d4-07697294b1e1",
			External:      false,
			Default:       false,
			Shared:        false,
			Name:          "test network",
			TaskID:        &NetworkDetailsTask,
			CreatorTaskID: &NetworkDetailsCreatorTask,
			Subnets: []instances.Subnet{{
				ID:         "351b0dd7-ca09-431c-be53-935db3785067",
				Name:       "test 2",
				IPVersion:  gcorecloud.IPv4,
				EnableDHCP: true,
				Cidr:       *PortNetworkSubnet1Cidr,
				CreatedAt:  gcorecloud.JSONRFC3339Z{Time: PortNetworkSubnet1CreatedAt},
				UpdatedAt:  &gcorecloud.JSONRFC3339Z{Time: PortNetworkSubnet1UpdatedAt},
				NetworkID:  "bc688791-f1b0-44eb-97d4-07697294b1e1",
				ProjectID:  1,
				RegionID:   1,
				Region:     "",
			}, {
				ID:         "0a641ef8-62dc-4146-91e5-6ab4b464df6d",
				Name:       "string",
				IPVersion:  gcorecloud.IPv4,
				EnableDHCP: true,
				Cidr:       *PortNetworkSubnet2Cidr,
				CreatedAt:  gcorecloud.JSONRFC3339Z{Time: PortNetworkSubnet2CreatedAt},
				UpdatedAt:  &gcorecloud.JSONRFC3339Z{Time: PortNetworkSubnet2UpdatedAt},
				NetworkID:  "bc688791-f1b0-44eb-97d4-07697294b1e1",
				ProjectID:  1,
				RegionID:   1,
				Region:     "",
			}},
			ProjectID: 1,
			RegionID:  1,
			Region:    "ED-8",
		},
		FloatingIPDetails: []instances.FloatingIP{{
			FloatingIPAddress: FloatingIP1,
			FixedIPAddress:    FixedIP1,
			Status:            "ACTIVE",
			RouterID:          "bf231ab1-769f-44db-bcb1-7f4199a1cba8",
			ID:                "f32fe70c-f2ce-492e-858a-621bdc234885",
			PortID:            "1f0ca628-a73b-42c0-bdac-7b10d023e097",
			CreatedAt:         gcorecloud.JSONRFC3339Z{Time: PortFloatingIP1CreatedAt},
			UpdatedAt:         &gcorecloud.JSONRFC3339Z{Time: PortFloatingIP1UpdatedAt},
			CreatorTaskID:     &PortFloatingIP1CreatorTaskID,
			ProjectID:         1,
			RegionID:          1,
			Region:            "ED-8",
		}, {
			FloatingIPAddress: FloatingIP2,
			FixedIPAddress:    FixedIP2,
			Status:            "ACTIVE",
			RouterID:          "bf231ab1-769f-44db-bcb1-7f4199a1cba8",
			ID:                "f32fe70c-f2ce-492e-858a-621bdc234441",
			PortID:            "1f0ca628-a73b-42c0-bdac-7b10d023e097",
			CreatedAt:         gcorecloud.JSONRFC3339Z{Time: PortFloatingIP2CreatedAt},
			UpdatedAt:         &gcorecloud.JSONRFC3339Z{Time: PortFloatingIP2UpdatedAt},
			CreatorTaskID:     &PortFloatingIP2CreatorTaskID,
			ProjectID:         1,
			RegionID:          1,
			Region:            "ED-8",
		}},
	}
	ExpectedInstancesSlice          = []instances.Instance{Instance1}
	ExpectedInstanceInterfacesSlice = []instances.Interface{InstanceInterface1}
	ExpectedSecurityGroupsSlice     = []gcorecloud.ItemIDName{SecurityGroup1}
	Tasks1                          = tasks.TaskResults{
		Tasks: []tasks.TaskID{"50f53a35-42ed-40c4-82b2-5a37fb3e00bc"},
	}
	Metadata1 = instances.Metadata{
		Key:      "cost-center",
		Value:    "Atlanta",
		ReadOnly: false,
	}
	Metadata2 = instances.Metadata{
		Key:      "data-center",
		Value:    "A",
		ReadOnly: false,
	}
	ExpectedMetadataList = []instances.Metadata{Metadata1, Metadata2}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL