testing

package
v1.1.39 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

loadbalancers unit tests

Index

Constants

View Source
const GetLoadbalancerStatsBody = `` /* 176-byte string literal not displayed */

LoadbalancerStatsTree is the canned request body of a Get request on loadbalancer's statistics.

View Source
const GetLoadbalancerStatusesBody = `` /* 821-byte string literal not displayed */

GetLoadbalancerStatusesBody is the canned request body of a Get request on loadbalancer's status.

View Source
const LoadbalancersListBody = `` /* 1320-byte string literal not displayed */

LoadbalancersListBody contains the canned body of a loadbalancer list response.

View Source
const PostFullyPopulatedLoadbalancerBody = `` /* 2754-byte string literal not displayed */

PostFullyPopulatedLoadbalancerBody is the canned response body of a Create request of an fully populated loadbalancer.

View Source
const PostUpdateLoadbalancerBody = `` /* 638-byte string literal not displayed */

PostUpdateLoadbalancerBody is the canned response body of a Update request on an existing loadbalancer.

View Source
const SingleLoadbalancerBody = `` /* 665-byte string literal not displayed */

SingleLoadbalancerBody is the canned body of a Get request on an existing loadbalancer.

Variables

View Source
var (
	LoadbalancerWeb = loadbalancers.LoadBalancer{
		ID:                 "c331058c-6a40-4144-948e-b9fb1df9db4b",
		ProjectID:          "54030507-44f7-473c-9342-b4d14a95f692",
		CreatedAt:          createdTime,
		UpdatedAt:          updatedTime,
		Name:               "web_lb",
		Description:        "lb config for the web tier",
		VipSubnetID:        "8a49c438-848f-467b-9655-ea1548708154",
		VipAddress:         "10.30.176.47",
		VipPortID:          "2a22e552-a347-44fd-b530-1f2b1b2a6735",
		FlavorID:           "60df399a-ee85-11e9-81b4-2a2ae2dbcce4",
		Provider:           "haproxy",
		AdminStateUp:       true,
		ProvisioningStatus: "ACTIVE",
		OperatingStatus:    "ONLINE",
		Tags:               []string{"test", "stage"},
	}
	LoadbalancerDb = loadbalancers.LoadBalancer{
		ID:                 "36e08a3e-a78f-4b40-a229-1e7e23eee1ab",
		ProjectID:          "54030507-44f7-473c-9342-b4d14a95f692",
		CreatedAt:          createdTime,
		UpdatedAt:          updatedTime,
		Name:               "db_lb",
		Description:        "lb config for the db tier",
		VipSubnetID:        "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
		VipAddress:         "10.30.176.48",
		VipPortID:          "2bf413c8-41a9-4477-b505-333d5cbe8b55",
		FlavorID:           "bba40eb2-ee8c-11e9-81b4-2a2ae2dbcce4",
		AvailabilityZone:   "db_az",
		Provider:           "haproxy",
		AdminStateUp:       true,
		ProvisioningStatus: "PENDING_CREATE",
		OperatingStatus:    "OFFLINE",
		Tags:               []string{"test", "stage"},
	}
	LoadbalancerUpdated = loadbalancers.LoadBalancer{
		ID:                 "36e08a3e-a78f-4b40-a229-1e7e23eee1ab",
		ProjectID:          "54030507-44f7-473c-9342-b4d14a95f692",
		CreatedAt:          createdTime,
		UpdatedAt:          updatedTime,
		Name:               "NewLoadbalancerName",
		Description:        "lb config for the db tier",
		VipSubnetID:        "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
		VipAddress:         "10.30.176.48",
		VipPortID:          "2bf413c8-41a9-4477-b505-333d5cbe8b55",
		FlavorID:           "bba40eb2-ee8c-11e9-81b4-2a2ae2dbcce4",
		Provider:           "haproxy",
		AdminStateUp:       true,
		ProvisioningStatus: "PENDING_CREATE",
		OperatingStatus:    "OFFLINE",
		Tags:               []string{"test"},
	}
	FullyPopulatedLoadBalancerDb = loadbalancers.LoadBalancer{
		Description:        "My favorite load balancer",
		AdminStateUp:       true,
		ProjectID:          "e3cd678b11784734bc366148aa37580e",
		UpdatedAt:          updatedTime,
		CreatedAt:          createdTime,
		ProvisioningStatus: "ACTIVE",
		VipSubnetID:        "d4af86e1-0051-488c-b7a0-527f97490c9a",
		VipNetworkID:       "d0d217df-3958-4fbf-a3c2-8dad2908c709",
		VipAddress:         "203.0.113.50",
		VipPortID:          "b4ca07d1-a31e-43e2-891a-7d14f419f342",
		AvailabilityZone:   "my_az",
		ID:                 "607226db-27ef-4d41-ae89-f2a800e9c2db",
		OperatingStatus:    "ONLINE",
		Name:               "best_load_balancer",
		FlavorID:           "",
		Provider:           "octavia",
		Tags:               []string{"test_tag"},
		Listeners: []listeners.Listener{{
			ID:               "95de30ec-67f4-437b-b3f3-22c5d9ef9828",
			ProjectID:        "e3cd678b11784734bc366148aa37580e",
			Name:             "redirect_listener",
			Description:      "",
			Protocol:         "HTTP",
			ProtocolPort:     8080,
			DefaultPoolID:    "c8cec227-410a-4a5b-af13-ecf38c2b0abb",
			AdminStateUp:     true,
			ConnLimit:        -1,
			SniContainerRefs: []string{},
			L7Policies: []l7policies.L7Policy{{
				ID:           "d0553837-f890-4981-b99a-f7cbd6a76577",
				Name:         "redirect_policy",
				ListenerID:   "95de30ec-67f4-437b-b3f3-22c5d9ef9828",
				ProjectID:    "e3cd678b11784734bc366148aa37580e",
				Description:  "",
				Action:       "REDIRECT_TO_URL",
				Position:     1,
				RedirectURL:  "https://www.example.com/",
				AdminStateUp: true,
				Rules:        []l7policies.Rule{},
			}},
		}},
		Pools: []pools.Pool{{
			LBMethod:     "ROUND_ROBIN",
			Protocol:     "HTTP",
			Description:  "",
			AdminStateUp: true,
			Name:         "rr_pool",
			ID:           "c8cec227-410a-4a5b-af13-ecf38c2b0abb",
			ProjectID:    "e3cd678b11784734bc366148aa37580e",
			Members: []pools.Member{{
				Name:         "",
				Address:      "192.0.2.16",
				SubnetID:     "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa",
				AdminStateUp: true,
				ProtocolPort: 80,
				ID:           "7d19ad6c-d549-453e-a5cd-05382c6be96a",
				ProjectID:    "e3cd678b11784734bc366148aa37580e",
				Weight:       1,
			}, {
				Name:         "",
				Address:      "192.0.2.19",
				SubnetID:     "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa",
				AdminStateUp: true,
				ProtocolPort: 80,
				ID:           "a167402b-caa6-41d5-b4d4-bde7f2cbfa5e",
				ProjectID:    "e3cd678b11784734bc366148aa37580e",
				Weight:       1,
			}},
			Monitor: monitors.Monitor{
				ID:             "a8a2aa3f-d099-4752-8265-e6472f8147f9",
				ProjectID:      "e3cd678b11784734bc366148aa37580e",
				Name:           "",
				Type:           "HTTP",
				Timeout:        1,
				MaxRetries:     2,
				Delay:          3,
				MaxRetriesDown: 3,
				HTTPMethod:     "GET",
				URLPath:        "/index.html",
				ExpectedCodes:  "200,201,202",
				AdminStateUp:   true,
			},
		}},
	}
	LoadbalancerStatusesTree = loadbalancers.StatusTree{
		Loadbalancer: &loadbalancers.LoadBalancer{
			ID:                 "36e08a3e-a78f-4b40-a229-1e7e23eee1ab",
			Name:               "db_lb",
			ProvisioningStatus: "PENDING_UPDATE",
			OperatingStatus:    "ACTIVE",
			Tags:               []string{"test", "stage"},
			Listeners: []listeners.Listener{{
				ID:                 "db902c0c-d5ff-4753-b465-668ad9656918",
				Name:               "db",
				ProvisioningStatus: "ACTIVE",
				Pools: []pools.Pool{{
					ID:                 "fad389a3-9a4a-4762-a365-8c7038508b5d",
					Name:               "db",
					ProvisioningStatus: "ACTIVE",
					Monitor: monitors.Monitor{
						ID:                 "67306cda-815d-4354-9fe4-59e09da9c3c5",
						Type:               "PING",
						ProvisioningStatus: "ACTIVE",
					},
					Members: []pools.Member{{
						ID:                 "2a280670-c202-4b0b-a562-34077415aabf",
						Name:               "db",
						Address:            "10.0.2.11",
						ProtocolPort:       80,
						ProvisioningStatus: "ACTIVE",
					}},
				}},
			}},
		},
	}
	LoadbalancerStatsTree = loadbalancers.Stats{
		ActiveConnections: 0,
		BytesIn:           9532,
		BytesOut:          22033,
		RequestErrors:     46,
		TotalConnections:  112,
	}
)

Functions

func HandleFullyPopulatedLoadbalancerCreationSuccessfully

func HandleFullyPopulatedLoadbalancerCreationSuccessfully(t *testing.T, response string)

HandleFullyPopulatedLoadbalancerCreationSuccessfully sets up the test server to respond to a fully populated loadbalancer creation request with a given response.

func HandleLoadbalancerCreationSuccessfully

func HandleLoadbalancerCreationSuccessfully(t *testing.T, response string)

HandleLoadbalancerCreationSuccessfully sets up the test server to respond to a loadbalancer creation request with a given response.

func HandleLoadbalancerDeletionSuccessfully

func HandleLoadbalancerDeletionSuccessfully(t *testing.T)

HandleLoadbalancerDeletionSuccessfully sets up the test server to respond to a loadbalancer deletion request.

func HandleLoadbalancerFailoverSuccessfully

func HandleLoadbalancerFailoverSuccessfully(t *testing.T)

HandleLoadbalancerFailoverSuccessfully sets up the test server to respond to a loadbalancer failover request.

func HandleLoadbalancerGetStatsTree

func HandleLoadbalancerGetStatsTree(t *testing.T)

HandleLoadbalancerGetStatsTree sets up the test server to respond to a loadbalancer Get stats tree request.

func HandleLoadbalancerGetStatusesTree

func HandleLoadbalancerGetStatusesTree(t *testing.T)

HandleLoadbalancerGetStatusesTree sets up the test server to respond to a loadbalancer Get statuses tree request.

func HandleLoadbalancerGetSuccessfully

func HandleLoadbalancerGetSuccessfully(t *testing.T)

HandleLoadbalancerGetSuccessfully sets up the test server to respond to a loadbalancer Get request.

func HandleLoadbalancerListSuccessfully

func HandleLoadbalancerListSuccessfully(t *testing.T)

HandleLoadbalancerListSuccessfully sets up the test server to respond to a loadbalancer List request.

func HandleLoadbalancerUpdateSuccessfully

func HandleLoadbalancerUpdateSuccessfully(t *testing.T)

HandleLoadbalancerUpdateSuccessfully sets up the test server to respond to a loadbalancer Update request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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