testutils

package
v1.6.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

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

View Source
const JOB_ERROR = "Cannot find job status for job id %s with cloud instance %s\n"
View Source
const NIL_ERROR = "[ERROR] %s must be set for %s integration tests"
View Source
const TEST_MESSAGE_HEADER_LENGTH = 100
View Source
const WARNING_ERROR = "[WARN] ENV variable %s is not set. Default value: %s = %s will be used. Required for %s tests\n"

Variables

View Source
var CloudConnectionID string = "" // CLOUD_CONNECTION_ID

=====================================

Resource Variables

===================================== Cloud Connection

View Source
var CloudConnectionName string = "Power-Go-Integration-Test" // CLOUD_CONNECTION_NAME
View Source
var CloudConnectionSpeed int64 = 50 // CLOUD_CONNECTION_SPEED
View Source
var CloudInstanceID string = ""
View Source
var DisableTesting bool = true

set to "true" / "false" to run or not run testing. set to false when pushing changes.

View Source
var IKEPolicyDhGroup int64 = 1 // IKE_POLICY_DH_GROUP
View Source
var IKEPolicyEncryption string = "aes-256-cbc" // IKE_POLICY_ENCRYPTION
View Source
var IKEPolicyID string = "" // IKE_POLICY_ID

VPN IKE Policy

View Source
var IKEPolicyKeyLifetime int = 180 // IKE_POLICY_KEY_LIFETIME
View Source
var IKEPolicyName string = "Power-Go-Integration-Test" // IKE_POLICY_NAME
View Source
var IKEPolicyPresharedKey string = "test" // IKE_POLICY_PRESHARED_KEY
View Source
var IKEPolicyVersion int64 = 1 // IKE_POLICY_VERSION
View Source
var IPSecPolicyAuthentication string = "hmac-sha-256-128" // IPSEC_POLICY_AUTHENTICATION
View Source
var IPSecPolicyDhGroup int64 = 1 // IPSEC_POLICY_DH_GROUP
View Source
var IPSecPolicyEncryption string = "aes-256-cbc" // IPSEC_POLICY_ENCRYPTION
View Source
var IPSecPolicyID string = "" // IPSEC_POLICY_ID

VPN IPSEC Policy

View Source
var IPSecPolicyKeyLifetime int = 180 // IPSEC_POLICY_KEY_LIFETIME
View Source
var IPSecPolicyName string = "Power-Go-Integration-Test" // IPSEC_POLICY_NAME
View Source
var IPSecPolicyPfs bool = true // IPSEC_POLICY_PFS
View Source
var ImageID string = "7fb4ac53-0928-4218-af9c-367e33d7c50e" // IMAGE_ID

Image

View Source
var ImageName string = "Power-Go-Integration-Test" // IMAGE_NAME
View Source
var ImageSource string = "" // IMAGE_SOURCE
View Source
var InstanceID string = "" // INSTANCE_ID

Instance

View Source
var InstanceImageID string = "5a18b1a4-47f6-4fc5-a921-5da487fc5c71" // INSTANCE_IMAGE_ID
View Source
var InstanceLicenseRepositoryCapacity int64 = 0 // INSTANCE_LRC (need to make VTL test)
View Source
var InstanceMemory float64 = 2 // INSTANCE_MEMORY
View Source
var InstanceName string = "Power-Go-Integration-Test" // INSTANCE_NAME
View Source
var InstanceNetworkID string = "074b8b59-cad7-4978-83e8-8490cc558e5b" // INSTANCE_NETWORK_ID
View Source
var InstanceProcType string = "shared" // INSTANCE_PROC_TYPE
View Source
var InstanceProcessors float64 = 4 // INSTANCE_PROCESSORS
View Source
var InstanceSSHKey string = "POWER-GO-INTEGRATION-TEST" // INSTANCE_SSH_KEY
View Source
var InstanceStorageType string = "tier1" // INSTANCE_STORAGE_TYPE
View Source
var InstanceSysType string = "e980" // INSTANCE_SYS_TYPE
View Source
var InstanceVolumeID string = "" // INSTANCE_VOLUME_ID
View Source
var JobTimeout int = 2000 // JOB_TIMEOUT
View Source
var NetworkAccessConfig models.AccessConfig = "internal-only" // NETWORK_ACCESS_CONFIG
View Source
var NetworkCidr string = "192.168.0.0/24" // NETWORK_CIDR
View Source
var NetworkDNSServer string = "127.0.0.1" // NETWORK_DNS_SERVER
View Source
var NetworkID string = "" // NETWORK_ID

Network

View Source
var NetworkJumbo bool = true // NETWORK_JUMBO
View Source
var NetworkMtu int64 = 1450 // NETWORK_MTU
View Source
var NetworkName string = "Power-Go-Integration-Test" // NETWORK_NAME
View Source
var NetworkType string = "vlan" // NETWORK_TYPE
View Source
var SSHKeyName string = "Power-Go-Integration-Test" // SSH_KEY_NAME

SSH Key

View Source
var SSHKeyRSA string = "" /* 587-byte string literal not displayed */

SSH_KEY_RSA

View Source
var SnapshotDescription string = "power go integration test" //SNAPSHOT_DESCRIPTION
View Source
var SnapshotInstanceID string = "c24e784c-3d4f-4344-9681-e6c6c1ddc181" // SNAPSHOT_INSTANCE_ID
View Source
var SnapshotName string = "Power-Go-Integration-Test" // SNAPSHOT_NAME

Snapshot

View Source
var StoragePool string = "Tier1-Flash-2" // STORAGE_POOL

Storage Capacity

View Source
var StorageType string = "tier1" // STORAGE_TYPE
View Source
var TimeoutAttempts int = 500000000000000 // TIMEOUT_ATTEMPTS
View Source
var VolumeID string = "" // VOLUME_ID

Volume

View Source
var VolumeName string = "Power-Go-Integration-Test" // VOLUME_NAME
View Source
var VolumeShareable bool = true // VOLUME_SHAREABLE
View Source
var VolumeSize float64 = 20 // VOLUME_SIZE
View Source
var VolumeType string = "tier1" // VOLUME_TYPE
View Source
var VpnID string = "" // VPN_ID

VPN

View Source
var VpnMode string = "policy" // VPN_MODE
View Source
var VpnName string = "Power-Go-Integration-Test" // VPN_NAME
View Source
var VpnNetworkID string = "84ff660d-1d21-40ec-b862-d44b535aea72" // VPN_NETWORK_ID
View Source
var VpnPeerGatewayAddress string = "1.22.124.1" // VPN_PEER_GATEWAY_ADDRESS
View Source
var VpnPeerSubnet string = "107.0.0.0/24" // VPN_PEER_SUBNET

Functions

func AccountPreCheck

func AccountPreCheck(t *testing.T)

AccountPreCheck verifies that all cloud / account variables are defined.

func CloudConnectionPreCheck

func CloudConnectionPreCheck(t *testing.T)

CloudConnectionPreCheck verifies that all Cloud Connection variables are defined.

func DHCPPreCheck

func DHCPPreCheck(t *testing.T)

DHCPPreCheck verifies that all DHCP variables are defined.

func IKEPolicyPreCheck

func IKEPolicyPreCheck(t *testing.T)

IKEPolicyPreCheck verifies that all VPN IKE Policy variables are defined.

func IPSecPreCheck

func IPSecPreCheck(t *testing.T)

IPSecPreCheck verifies that all VPN IPSec Policy variables are defined.

func ImagePreCheck

func ImagePreCheck(t *testing.T)

ImagePreCheck verifies that all Image variables are defined.

func InstancePreCheck

func InstancePreCheck(t *testing.T)

InstancePreCheck verifies that all Instance variables are defined.

func NetworkPreCheck

func NetworkPreCheck(t *testing.T)

NetworkPreCheck verifies that all Network variables are defined.

func SSHKeyPreCheck

func SSHKeyPreCheck(t *testing.T)

SSHKeyPreCheck verifies that all SSH Key variables are defined.

func SnapshotPreCheck

func SnapshotPreCheck(t *testing.T)

SnapshotPreCheck verifies that all Snapshot Variables are defined.

func StorageCapacityPreCheck

func StorageCapacityPreCheck(t *testing.T)

StorageCapacityPreCheck verifies that all Storage Capacity variables are defined.

func TestMessage

func TestMessage(msg string, id string, response interface{})

testMessage formats an prints a response.

func TestSession

func TestSession(t *testing.T) *ps.IBMPISession

TestSession returns an *IBMPISession for testing.

func VPNPreCheck

func VPNPreCheck(t *testing.T)

VPNPreCheck verifies that all VPN variables are defined.

func VolumePreCheck

func VolumePreCheck(t *testing.T)

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.

Jump to

Keyboard shortcuts

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