testing

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

subnets unit tests

Index

Constants

View Source
const CreateRequestGW = `` /* 164-byte string literal not displayed */
View Source
const CreateRequestNoGW = `` /* 185-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 MetadataCreateRequest = `
{
"test1": "test1", 
"test2": "test2"
}
`
View Source
const MetadataListResponse = `` /* 215-byte string literal not displayed */
View Source
const MetadataResponse = `
{
  "key": "some_key",
  "value": "some_val",
  "read_only": false
}
`
View Source
const UpdateRequestGW = `
{
 	"name": "subnet",
    "enable_dhcp": true,
    "dns_nameservers": null,
    "host_routes": null
}
`
View Source
const UpdateRequestNoData = `
{
    "enable_dhcp": false,
    "dns_nameservers": [],
    "host_routes": [],
    "gateway_ip": null
}
`
View Source
const UpdateRequestNoGW = `` /* 126-byte string literal not displayed */

Variables

View Source
var (
	Subnet1 = subnets.Subnet{
		ID:             "e7944e55-f957-413d-aa56-fdc876543113",
		Name:           "subnet",
		IPVersion:      4,
		EnableDHCP:     true,
		CIDR:           *cidr,
		CreatedAt:      createdTime,
		UpdatedAt:      updatedTime,
		NetworkID:      "ee2402d0-f0cd-4503-9b75-69be1d11c5f1",
		TaskID:         taskID,
		CreatorTaskID:  taskID,
		Region:         "RegionOne",
		ProjectID:      fake.ProjectID,
		RegionID:       fake.RegionID,
		AvailableIps:   IPDual("18446744073709551999"),
		TotalIps:       IPDual("18446744073709552000"),
		HasRouter:      true,
		DNSNameservers: []net.IP{ip},
		GatewayIP:      gwip,
		HostRoutes: []subnets.HostRoute{
			{Destination: *routeCidr, NextHop: ip},
		},
		Metadata: []metadata.Metadata{ResourceMetadataReadOnly},
	}
	Tasks1 = tasks.TaskResults{
		Tasks: []tasks.TaskID{"50f53a35-42ed-40c4-82b2-5a37fb3e00bc"},
	}

	ExpectedSubnetSlice = []subnets.Subnet{Subnet1}

	ResourceMetadata = map[string]interface{}{
		"some_key": "some_val",
	}

	ResourceMetadataReadOnly = metadata.Metadata{
		Key:      "some_key",
		Value:    "some_val",
		ReadOnly: false,
	}

	Metadata1 = metadata.Metadata{
		Key:      "cost-center",
		Value:    "Atlanta",
		ReadOnly: false,
	}
	Metadata2 = metadata.Metadata{
		Key:      "data-center",
		Value:    "A",
		ReadOnly: false,
	}
	ExpectedMetadataList = []metadata.Metadata{Metadata1, Metadata2}
)
View Source
var GetResponse = fmt.Sprintf(`
{
  "id": "e7944e55-f957-413d-aa56-fdc876543113",
  "name": "subnet",
  "ip_version": 4,
  "enable_dhcp": true,
  "cidr": "192.168.10.0/24",
  "created_at": "2020-03-05T12:03:24+0000",
  "updated_at": "2020-03-05T12:03:25+0000",
  "network_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1",
  "task_id": "50f53a35-42ed-40c4-82b2-5a37fb3e00bc",
  "creator_task_id": "50f53a35-42ed-40c4-82b2-5a37fb3e00bc",
  "region": "RegionOne",
  "project_id": 1,
  "region_id": 1,
  "available_ips": 18446744073709551999,
  "total_ips": 18446744073709552000,
  "dns_nameservers": [
	"10.0.0.13"
  ],
  "gateway_ip" : "10.0.0.1",
  "has_router": true,
  "host_routes": [
    {
      "destination": "10.0.3.0/24",
      "nexthop": "10.0.0.13"
    }
  ],
  "metadata": [%s]
}
`, MetadataResponse)
View Source
var ListResponse = fmt.Sprintf(`
{
  	"count": 1,
  	"results": [
		{
		  "id": "e7944e55-f957-413d-aa56-fdc876543113",
		  "name": "subnet",
		  "ip_version": 4,
		  "enable_dhcp": true,
		  "cidr": "192.168.10.0/24",
		  "created_at": "2020-03-05T12:03:24+0000",
		  "updated_at": "2020-03-05T12:03:25+0000",
		  "network_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1",
		  "task_id": "50f53a35-42ed-40c4-82b2-5a37fb3e00bc",
		  "creator_task_id": "50f53a35-42ed-40c4-82b2-5a37fb3e00bc",
		  "region": "RegionOne",
		  "available_ips": 18446744073709551999,
		  "total_ips": 18446744073709552000,
		  "project_id": 1,
		  "region_id": 1,
		  "dns_nameservers": [
			"10.0.0.13"
		  ],
		  "gateway_ip" : "10.0.0.1",
		  "has_router": true,
		  "host_routes": [
			{
			  "destination": "10.0.3.0/24",
			  "nexthop": "10.0.0.13"
			}
		  ],
          "metadata": [%s]
    	}
  	]
}
`, MetadataResponse)

Functions

func IPDual

func IPDual(i string) *big.Int

Types

This section is empty.

Jump to

Keyboard shortcuts

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