Help us shape the future of Go! Take the 2026 Go Developer Survey

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const CapsuleGetBody_NewTime = `` /* 2638-byte string literal not displayed */
View Source
const CapsuleGetBody_OldTime = `` /* 2668-byte string literal not displayed */
View Source
const CapsuleListBody = `` /* 1443-byte string literal not displayed */
View Source
const CapsuleV132ListBody = `` /* 1197-byte string literal not displayed */
View Source
const ValidJSONTemplate = `` /* 793-byte string literal not displayed */

ValidJSONTemplate is a valid OpenStack Capsule template in JSON format

View Source
const ValidYAMLTemplate = `` /* 478-byte string literal not displayed */

ValidYAMLTemplate is a valid OpenStack Capsule template in YAML format

Variables

View Source
var ExpectedCapsule = capsules.Capsule{
	UUID:      "cc654059-1a77-47a3-bfcf-715bde5aad9e",
	Status:    "Running",
	UserID:    "d33b18c384574fd2a3299447aac285f0",
	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
	CPU:       float64(1),
	Memory:    "1024M",
	MetaName:  "test",
	Links: []interface{}{
		map[string]interface{}{
			"href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
			"rel":  "self",
		},
		map[string]interface{}{
			"href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
			"rel":  "bookmark",
		},
	},
	CapsuleVersion: "beta",
	RestartPolicy:  "always",
	MetaLabels: map[string]string{
		"web": "app",
	},
	ContainersUUIDs: []string{
		"1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
	},
	Addresses: map[string][]capsules.Address{
		"b1295212-64e1-471d-aa01-25ff46f9818d": []capsules.Address{
			{
				PreserveOnDelete: false,
				Addr:             "172.24.4.11",
				Port:             "8439060f-381a-4386-a518-33d5a4058636",
				Version:          float64(4),
				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
			},
		},
	},
	VolumesInfo: map[string][]string{
		"67618d54-dd55-4f7e-91b3-39ffb3ba7f5f": []string{
			"1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
		},
	},
	Host:         "test-host",
	StatusReason: "No reason",
	Containers: []capsules.Container{
		ExpectedContainer1,
	},
}
View Source
var ExpectedCapsuleV132 = capsules.CapsuleV132{
	UUID:      "cc654059-1a77-47a3-bfcf-715bde5aad9e",
	Status:    "Running",
	UserID:    "d33b18c384574fd2a3299447aac285f0",
	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
	CPU:       float64(1),
	Memory:    "1024M",
	MetaName:  "test",
	Links: []interface{}{
		map[string]interface{}{
			"href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
			"rel":  "self",
		},
		map[string]interface{}{
			"href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
			"rel":  "bookmark",
		},
	},
	RestartPolicy: map[string]string{
		"MaximumRetryCount": "0",
		"Name":              "always",
	},
	MetaLabels: map[string]string{
		"web": "app",
	},
	Addresses: map[string][]capsules.Address{
		"b1295212-64e1-471d-aa01-25ff46f9818d": []capsules.Address{
			{
				PreserveOnDelete: false,
				Addr:             "172.24.4.11",
				Port:             "8439060f-381a-4386-a518-33d5a4058636",
				Version:          float64(4),
				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
			},
		},
	},
	Host:         "test-host",
	StatusReason: "No reason",
	Containers: []capsules.Container{
		ExpectedContainer1,
	},
}
View Source
var ExpectedContainer1 = capsules.Container{
	Name:      "test-demo-omicron-13",
	UUID:      "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
	UserID:    "d33b18c384574fd2a3299447aac285f0",
	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
	CPU:       float64(1),
	Memory:    "1024M",
	Host:      "test-host",
	Status:    "Running",
	Image:     "test",
	Labels: map[string]string{
		"foo": "bar",
	},
	WorkDir: "/root",
	Disk:    0,
	Command: []string{
		"testcmd",
	},
	Ports: []int{
		80,
	},
	SecurityGroups: []string{
		"default",
	},
	ImagePullPolicy: "ifnotpresent",
	Runtime:         "runc",
	TaskState:       "Creating",
	HostName:        "test-hostname",
	Environment: map[string]string{
		"USER1": "test",
	},
	StatusReason: "No reason",
	StatusDetail: "Just created",
	ImageDriver:  "docker",
	Interactive:  true,
	AutoRemove:   false,
	AutoHeal:     false,
	RestartPolicy: map[string]string{
		"MaximumRetryCount": "0",
		"Name":              "always",
	},
	Addresses: map[string][]capsules.Address{
		"b1295212-64e1-471d-aa01-25ff46f9818d": []capsules.Address{
			{
				PreserveOnDelete: false,
				Addr:             "172.24.4.11",
				Port:             "8439060f-381a-4386-a518-33d5a4058636",
				Version:          float64(4),
				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
			},
		},
	},
}
View Source
var ValidJSONTemplateParsed = map[string]interface{}{
	"capsuleVersion": "beta",
	"kind":           "capsule",
	"metadata": map[string]interface{}{
		"name": "template",
		"labels": map[string]string{
			"app":  "web",
			"app1": "web1",
		},
	},
	"spec": map[string]interface{}{
		"restartPolicy": "Always",
		"containers": []map[string]interface{}{
			map[string]interface{}{
				"image": "ubuntu",
				"command": []interface{}{
					"/bin/bash",
				},
				"imagePullPolicy": "ifnotpresent",
				"workDir":         "/root",
				"ports": []interface{}{
					map[string]interface{}{
						"name":          "nginx-port",
						"containerPort": float64(80),
						"hostPort":      float64(80),
						"protocol":      "TCP",
					},
				},
				"resources": map[string]interface{}{
					"requests": map[string]interface{}{
						"cpu":    float64(1),
						"memory": float64(1024),
					},
				},
				"env": map[string]interface{}{
					"ENV1": "/usr/local/bin",
					"ENV2": "/usr/bin",
				},
			},
		},
	},
}

ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate

View Source
var ValidYAMLTemplateParsed = map[string]interface{}{
	"capsuleVersion": "beta",
	"kind":           "capsule",
	"metadata": map[string]interface{}{
		"name": "template",
		"labels": map[string]string{
			"app":  "web",
			"app1": "web1",
		},
	},
	"spec": map[interface{}]interface{}{
		"restartPolicy": "Always",
		"containers": []map[interface{}]interface{}{
			map[interface{}]interface{}{
				"image": "ubuntu",
				"command": []interface{}{
					"/bin/bash",
				},
				"imagePullPolicy": "ifnotpresent",
				"workDir":         "/root",
				"ports": []interface{}{
					map[interface{}]interface{}{
						"name":          "nginx-port",
						"containerPort": 80,
						"hostPort":      80,
						"protocol":      "TCP",
					},
				},
				"resources": map[interface{}]interface{}{
					"requests": map[interface{}]interface{}{
						"cpu":    1,
						"memory": 1024,
					},
				},
				"env": map[interface{}]interface{}{
					"ENV1": "/usr/local/bin",
					"ENV2": "/usr/bin",
				},
			},
		},
	},
}

ValidYAMLTemplateParsed is the expected parsed version of ValidYAMLTemplate

Functions

func HandleCapsuleCreateSuccessfully

func HandleCapsuleCreateSuccessfully(t *testing.T)

HandleCapsuleCreateSuccessfully creates an HTTP handler at `/capsules` on the test handler mux that responds with a `Create` response.

func HandleCapsuleDeleteSuccessfully

func HandleCapsuleDeleteSuccessfully(t *testing.T)

func HandleCapsuleGetNewTimeSuccessfully

func HandleCapsuleGetNewTimeSuccessfully(t *testing.T)

HandleCapsuleGetNewTimeSuccessfully test setup

func HandleCapsuleGetOldTimeSuccessfully

func HandleCapsuleGetOldTimeSuccessfully(t *testing.T)

HandleCapsuleGetOldTimeSuccessfully test setup

func HandleCapsuleListSuccessfully

func HandleCapsuleListSuccessfully(t *testing.T)

HandleCapsuleListSuccessfully test setup

func HandleCapsuleV132ListSuccessfully

func HandleCapsuleV132ListSuccessfully(t *testing.T)

HandleCapsuleV132ListSuccessfully test setup

Types

This section is empty.

Jump to

Keyboard shortcuts

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