testing

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

simple tenant usage unit tests

Index

Constants

View Source
const FirstTenantID = "aabbccddeeff112233445566"
View Source
const GetAllTenants = `` /* 2525-byte string literal not displayed */

GetAllTenants holds the fixtures for the content of the request for all tenants.

View Source
const GetSingleTenant = `` /* 2044-byte string literal not displayed */

GetSingleTenant holds the fixtures for the content of the request for a single tenant.

View Source
const SecondTenantID = "665544332211ffeeddccbbaa"

Variables

View Source
var AllTenantsUsageResult = []usage.TenantUsage{
	{
		ServerUsages: []usage.ServerUsage{
			{
				Flavor:     "m1.tiny",
				Hours:      0.021675453333333334,
				InstanceID: "a70096fd-8196-406b-86c4-045840f53ad7",
				LocalGB:    1,
				MemoryMB:   512,
				Name:       "jttest",
				StartedAt:  time.Date(2017, 11, 30, 3, 23, 43, 0, time.UTC),
				State:      "active",
				TenantID:   "aabbccddeeff112233445566",
				Uptime:     78,
				VCPUs:      1,
			},
			{
				Flavor:     "m1.acctest",
				Hours:      0.33444444444444443,
				InstanceID: "c04e38f2-dcee-4ca8-9466-7708d0a9b6dd",
				LocalGB:    15,
				MemoryMB:   512,
				Name:       "basic",
				StartedAt:  time.Date(2017, 11, 21, 3, 50, 7, 0, time.UTC),
				EndedAt:    time.Date(2017, 11, 21, 4, 10, 11, 0, time.UTC),
				State:      "terminated",
				TenantID:   "aabbccddeeff112233445566",
				Uptime:     1204,
				VCPUs:      1,
			},
			{
				Flavor:     "m1.acctest",
				Hours:      0.004166666666666667,
				InstanceID: "ceb654fa-e0e8-44fb-8942-e4d0bfad3941",
				LocalGB:    15,
				MemoryMB:   512,
				Name:       "ACPTTESTJSxbPQAC34lTnBE1",
				StartedAt:  time.Date(2017, 11, 30, 3, 21, 6, 0, time.UTC),
				EndedAt:    time.Date(2017, 11, 30, 3, 21, 21, 0, time.UTC),
				State:      "terminated",
				TenantID:   "aabbccddeeff112233445566",
				Uptime:     15,
				VCPUs:      1,
			},
		},
		Start:              time.Date(2017, 11, 2, 3, 25, 1, 0, time.UTC),
		Stop:               time.Date(2017, 11, 30, 3, 25, 1, 0, time.UTC),
		TenantID:           "aabbccddeeff112233445566",
		TotalHours:         1.25834212,
		TotalLocalGBUsage:  18.571675453333334,
		TotalMemoryMBUsage: 644.27116544,
		TotalVCPUsUsage:    1.25834212,
	},
	{
		ServerUsages: []usage.ServerUsage{
			{
				Flavor:     "m1.tiny",
				Hours:      0.021675453333333334,
				InstanceID: "a70096fd-8196-406b-86c4-045840f53ad7",
				LocalGB:    1,
				MemoryMB:   512,
				Name:       "test",
				StartedAt:  time.Date(2017, 11, 30, 3, 23, 43, 0, time.UTC),
				State:      "active",
				TenantID:   "665544332211ffeeddccbbaa",
				Uptime:     78,
				VCPUs:      1,
			},
		},
		Start:              time.Date(2017, 11, 2, 3, 25, 1, 0, time.UTC),
		Stop:               time.Date(2017, 11, 30, 3, 25, 1, 0, time.UTC),
		TenantID:           "665544332211ffeeddccbbaa",
		TotalHours:         0.021675453333333334,
		TotalLocalGBUsage:  18.571675453333334,
		TotalMemoryMBUsage: 644.27116544,
		TotalVCPUsUsage:    1.25834212,
	},
}

AllTenantsUsageResult is the code fixture for GetAllTenants.

View Source
var SingleTenantUsageResults = usage.TenantUsage{
	ServerUsages: []usage.ServerUsage{
		{
			Flavor:     "m1.tiny",
			Hours:      0.021675453333333334,
			InstanceID: "a70096fd-8196-406b-86c4-045840f53ad7",
			LocalGB:    1,
			MemoryMB:   512,
			Name:       "jttest",
			StartedAt:  time.Date(2017, 11, 30, 3, 23, 43, 0, time.UTC),
			State:      "active",
			TenantID:   "aabbccddeeff112233445566",
			Uptime:     78,
			VCPUs:      1,
		},
		{
			Flavor:     "m1.acctest",
			Hours:      0.33444444444444443,
			InstanceID: "c04e38f2-dcee-4ca8-9466-7708d0a9b6dd",
			LocalGB:    15,
			MemoryMB:   512,
			Name:       "basic",
			StartedAt:  time.Date(2017, 11, 21, 3, 50, 7, 0, time.UTC),
			EndedAt:    time.Date(2017, 11, 21, 4, 10, 11, 0, time.UTC),
			State:      "terminated",
			TenantID:   "aabbccddeeff112233445566",
			Uptime:     1204,
			VCPUs:      1,
		},
		{
			Flavor:     "m1.acctest",
			Hours:      0.004166666666666667,
			InstanceID: "ceb654fa-e0e8-44fb-8942-e4d0bfad3941",
			LocalGB:    15,
			MemoryMB:   512,
			Name:       "ACPTTESTJSxbPQAC34lTnBE1",
			StartedAt:  time.Date(2017, 11, 30, 3, 21, 6, 0, time.UTC),
			EndedAt:    time.Date(2017, 11, 30, 3, 21, 21, 0, time.UTC),
			State:      "terminated",
			TenantID:   "aabbccddeeff112233445566",
			Uptime:     15,
			VCPUs:      1,
		},
	},
	Start:              time.Date(2017, 11, 2, 3, 25, 1, 0, time.UTC),
	Stop:               time.Date(2017, 11, 30, 3, 25, 1, 0, time.UTC),
	TenantID:           "aabbccddeeff112233445566",
	TotalHours:         1.25834212,
	TotalLocalGBUsage:  18.571675453333334,
	TotalMemoryMBUsage: 644.27116544,
	TotalVCPUsUsage:    1.25834212,
}

SingleTenantUsageResults is the code fixture for GetSingleTenant.

Functions

func HandleGetAllTenantsSuccessfully

func HandleGetAllTenantsSuccessfully(t *testing.T)

HandleGetAllTenantsSuccessfully configures the test server to respond to a Get request for all tenants.

func HandleGetSingleTenantSuccessfully

func HandleGetSingleTenantSuccessfully(t *testing.T)

HandleGetSingleTenantSuccessfully configures the test server to respond to a Get request for a single tenant

Types

This section is empty.

Jump to

Keyboard shortcuts

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