Documentation ¶
Overview ¶
Package testutils implements tests for the Power-Go-Client:
Files
- integration_utils.go: Defines commonly used test functions
- integration_variables.go: Lists default values for all test variables
- example.env: An example .env which is used when overriding default test variables
- launch.json: An example test configuration
- client/instance/*_test.go: Defines tests for an individual resource type
To run a test:
- Set DisableTesting = False in integration_variables.go
- Create a .vscode folder in the project
- Copy and rename launch.json and .env into .vscode
- Either
- Use default variables in integration_variables.go
- Define variables in .env
- Double click the test function name to select the text. launch.json uses this text
- Click "Run and Debug" on the VScode sidebar, and then click "Run a test"
- Output will be visible in the VScode Debug Console
Package testutils implements tests for the Power-Go-Client:
Files
- integration_utils.go: Defines commonly used test functions
- integration_variables.go: Lists default values for all test variables
- example.env: An example .env which is used when overriding default test variables
- launch.json: An example test configuration
- client/instance/*_test.go: Defines tests for an individual resource type
To run a test:
- Set DisableTesting = False in this file
- Create a .vscode folder in the project
- Copy and rename launch.json and .env into .vscode
- Either
- Use default variables in integration_variables.go
- Define variables in .env
- Double click the test function name to select the text. launch.json uses this text
- Click "Run and Debug" on the VScode sidebar, and then click "Run a test"
- Output will be visible in the VScode Debug Console
Index ¶
- Constants
- Variables
- func AccountPreCheck(t *testing.T)
- func CloudConnectionPreCheck(t *testing.T)
- func DHCPPreCheck(t *testing.T)
- func IKEPolicyPreCheck(t *testing.T)
- func IPSecPreCheck(t *testing.T)
- func ImagePreCheck(t *testing.T)
- func InstancePreCheck(t *testing.T)
- func NetworkPreCheck(t *testing.T)
- func SSHKeyPreCheck(t *testing.T)
- func SnapshotPreCheck(t *testing.T)
- func StorageCapacityPreCheck(t *testing.T)
- func TestMessage(msg string, id string, response interface{})
- func TestSession(t *testing.T) *ps.IBMPISession
- func VPNPreCheck(t *testing.T)
- func VolumePreCheck(t *testing.T)
- func WaitForJobState(t *testing.T, jobClient *client.IBMPIJobClient, jobId string)
Constants ¶
const JOB_ERROR = "Cannot find job status for job id %s with cloud instance %s\n"
const NIL_ERROR = "[ERROR] %s must be set for %s integration tests"
const TEST_MESSAGE_HEADER_LENGTH = 100
const WARNING_ERROR = "[WARN] ENV variable %s is not set. Default value: %s = %s will be used. Required for %s tests\n"
Variables ¶
var CloudConnectionID string = "" // CLOUD_CONNECTION_ID
=====================================
Resource Variables
===================================== Cloud Connection
var CloudConnectionName string = "Power-Go-Integration-Test" // CLOUD_CONNECTION_NAME
var CloudConnectionSpeed int64 = 50 // CLOUD_CONNECTION_SPEED
var CloudInstanceID string = ""
var DisableTesting bool = true
set to "true" / "false" to run or not run testing. set to false when pushing changes.
var IKEPolicyDhGroup int64 = 1 // IKE_POLICY_DH_GROUP
var IKEPolicyEncryption string = "aes-256-cbc" // IKE_POLICY_ENCRYPTION
var IKEPolicyID string = "" // IKE_POLICY_ID
VPN IKE Policy
var IKEPolicyKeyLifetime int = 180 // IKE_POLICY_KEY_LIFETIME
var IKEPolicyName string = "Power-Go-Integration-Test" // IKE_POLICY_NAME
var IKEPolicyVersion int64 = 1 // IKE_POLICY_VERSION
var IPSecPolicyAuthentication string = "hmac-sha-256-128" // IPSEC_POLICY_AUTHENTICATION
var IPSecPolicyDhGroup int64 = 1 // IPSEC_POLICY_DH_GROUP
var IPSecPolicyEncryption string = "aes-256-cbc" // IPSEC_POLICY_ENCRYPTION
var IPSecPolicyID string = "" // IPSEC_POLICY_ID
VPN IPSEC Policy
var IPSecPolicyKeyLifetime int = 180 // IPSEC_POLICY_KEY_LIFETIME
var IPSecPolicyName string = "Power-Go-Integration-Test" // IPSEC_POLICY_NAME
var IPSecPolicyPfs bool = true // IPSEC_POLICY_PFS
var ImageID string = "7fb4ac53-0928-4218-af9c-367e33d7c50e" // IMAGE_ID
Image
var ImageName string = "Power-Go-Integration-Test" // IMAGE_NAME
var ImageSource string = "" // IMAGE_SOURCE
var InstanceID string = "" // INSTANCE_ID
Instance
var InstanceImageID string = "5a18b1a4-47f6-4fc5-a921-5da487fc5c71" // INSTANCE_IMAGE_ID
var InstanceLicenseRepositoryCapacity int64 = 0 // INSTANCE_LRC (need to make VTL test)
var InstanceMemory float64 = 2 // INSTANCE_MEMORY
var InstanceName string = "Power-Go-Integration-Test" // INSTANCE_NAME
var InstanceNetworkID string = "074b8b59-cad7-4978-83e8-8490cc558e5b" // INSTANCE_NETWORK_ID
var InstanceProcType string = "shared" // INSTANCE_PROC_TYPE
var InstanceProcessors float64 = 4 // INSTANCE_PROCESSORS
var InstanceSSHKey string = "POWER-GO-INTEGRATION-TEST" // INSTANCE_SSH_KEY
var InstanceStorageType string = "tier1" // INSTANCE_STORAGE_TYPE
var InstanceSysType string = "e980" // INSTANCE_SYS_TYPE
var InstanceVolumeID string = "" // INSTANCE_VOLUME_ID
var JobTimeout int = 2000 // JOB_TIMEOUT
var NetworkCidr string = "192.168.0.0/24" // NETWORK_CIDR
var NetworkDNSServer string = "127.0.0.1" // NETWORK_DNS_SERVER
var NetworkID string = "" // NETWORK_ID
Network
var NetworkJumbo bool = true // NETWORK_JUMBO
var NetworkName string = "Power-Go-Integration-Test" // NETWORK_NAME
var NetworkType string = "vlan" // NETWORK_TYPE
var SSHKeyName string = "Power-Go-Integration-Test" // SSH_KEY_NAME
SSH Key
var SSHKeyRSA string = "" /* 587-byte string literal not displayed */
SSH_KEY_RSA
var SnapshotDescription string = "power go integration test" //SNAPSHOT_DESCRIPTION
var SnapshotInstanceID string = "c24e784c-3d4f-4344-9681-e6c6c1ddc181" // SNAPSHOT_INSTANCE_ID
var SnapshotName string = "Power-Go-Integration-Test" // SNAPSHOT_NAME
Snapshot
var StoragePool string = "Tier1-Flash-2" // STORAGE_POOL
Storage Capacity
var StorageType string = "tier1" // STORAGE_TYPE
var TimeoutAttempts int = 500000000000000 // TIMEOUT_ATTEMPTS
var VolumeID string = "" // VOLUME_ID
Volume
var VolumeName string = "Power-Go-Integration-Test" // VOLUME_NAME
var VolumeSize float64 = 20 // VOLUME_SIZE
var VolumeType string = "tier1" // VOLUME_TYPE
var VpnID string = "" // VPN_ID
VPN
var VpnMode string = "policy" // VPN_MODE
var VpnName string = "Power-Go-Integration-Test" // VPN_NAME
var VpnNetworkID string = "84ff660d-1d21-40ec-b862-d44b535aea72" // VPN_NETWORK_ID
var VpnPeerGatewayAddress string = "1.22.124.1" // VPN_PEER_GATEWAY_ADDRESS
var VpnPeerSubnet string = "107.0.0.0/24" // VPN_PEER_SUBNET
Functions ¶
func AccountPreCheck ¶
AccountPreCheck verifies that all cloud / account variables are defined.
func CloudConnectionPreCheck ¶
CloudConnectionPreCheck verifies that all Cloud Connection variables are defined.
func DHCPPreCheck ¶
DHCPPreCheck verifies that all DHCP variables are defined.
func IKEPolicyPreCheck ¶
IKEPolicyPreCheck verifies that all VPN IKE Policy variables are defined.
func IPSecPreCheck ¶
IPSecPreCheck verifies that all VPN IPSec Policy variables are defined.
func ImagePreCheck ¶
ImagePreCheck verifies that all Image variables are defined.
func InstancePreCheck ¶
InstancePreCheck verifies that all Instance variables are defined.
func NetworkPreCheck ¶
NetworkPreCheck verifies that all Network variables are defined.
func SSHKeyPreCheck ¶
SSHKeyPreCheck verifies that all SSH Key variables are defined.
func SnapshotPreCheck ¶
SnapshotPreCheck verifies that all Snapshot Variables are defined.
func StorageCapacityPreCheck ¶
StorageCapacityPreCheck verifies that all Storage Capacity variables are defined.
func TestMessage ¶
testMessage formats an prints a response.
func TestSession ¶
func TestSession(t *testing.T) *ps.IBMPISession
TestSession returns an *IBMPISession for testing.
func VPNPreCheck ¶
VPNPreCheck verifies that all VPN variables are defined.
func VolumePreCheck ¶
VolumePreCheck verifies that all Volume variables are defined.
func WaitForJobState ¶
func WaitForJobState(t *testing.T, jobClient *client.IBMPIJobClient, jobId string)
WaitForJobState waits for a job to be completed before returning.
Types ¶
This section is empty.