Documentation ¶
Index ¶
- Constants
- func PrintTests(ctx context.Context, storageClient *storage.Client, ...)
- func ValidateTests(ctx context.Context, storageClient *storage.Client, ...) error
- type Network
- type Subnetwork
- type TestSuites
- type TestVM
- func (t *TestVM) AddAliasIPRanges(aliasIPRange, rangeName string) error
- func (t *TestVM) AddCustomNetwork(network *Network, subnetwork *Subnetwork) error
- func (t *TestVM) AddMetadata(key, value string)
- func (t *TestVM) AddScope(scope string)
- func (t *TestVM) AddUser(user, publicKey string)
- func (t *TestVM) EnableConfidentialInstance()
- func (t *TestVM) EnableSecureBoot()
- func (t *TestVM) ForceMachineType(machinetype string)
- func (t *TestVM) ForceZone(z string)
- func (t *TestVM) Reboot() error
- func (t *TestVM) ResizeDiskAndReboot(diskSize int) error
- func (t *TestVM) Resume() error
- func (t *TestVM) RunTests(runtest string)
- func (t *TestVM) SetMinCPUPlatform(minCPUPlatform string)
- func (t *TestVM) SetNetworkPerformanceTier(tier string) error
- func (t *TestVM) SetPrivateIP(network *Network, networkIP string) error
- func (t *TestVM) SetShutdownScript(script string)
- func (t *TestVM) SetShutdownScriptURL(script string) error
- func (t *TestVM) SetStartupScript(script string)
- func (t *TestVM) SetWindowsShutdownScript(script string)
- func (t *TestVM) SetWindowsShutdownScriptURL(script string) error
- func (t *TestVM) SetWindowsStartupScript(script string)
- func (t *TestVM) UseGVNIC()
- type TestWorkflow
- func (t *TestWorkflow) AddSSHKey(user string) (string, error)
- func (t *TestWorkflow) CreateNetwork(networkName string, autoCreateSubnetworks bool) (*Network, error)
- func (t *TestWorkflow) CreateTestVM(name string) (*TestVM, error)
- func (t *TestWorkflow) CreateTestVMBeta(name string) (*TestVM, error)
- func (t *TestWorkflow) CreateTestVMFromInstanceBeta(i *daisy.InstanceBeta, disks []*compute.Disk) (*TestVM, error)
- func (t *TestWorkflow) CreateTestVMMultipleDisks(disks []*compute.Disk, instanceParams *daisy.Instance) (*TestVM, error)
- func (t *TestWorkflow) LockProject()
- func (t *TestWorkflow) Skip(message string)
- func (t *TestWorkflow) SkippedMessage() string
- func (t *TestWorkflow) WaitForDisksQuota(qa *daisy.QuotaAvailable) error
- func (t *TestWorkflow) WaitForVMQuota(qa *daisy.QuotaAvailable) error
Constants ¶
const ( // ShouldRebootDuringTest is a local map key to indicate that the // test will reboot and relies on results from the second boot. ShouldRebootDuringTest = "shouldRebootDuringTest" // DefaultSourceRange is the RFC-1918 range used in default rules. DefaultSourceRange = "10.128.0.0/9" // DefaultMTU is the default MTU set for a network. DefaultMTU = 1460 // JumboFramesMTU is the maximum MTU settable for a network. JumboFramesMTU = 8896 // DefaultMachineType is the default machine type when machine type isn't specified. DefaultMachineType = "n1-standard-1" )
const ( // PdStandard disktype string PdStandard = "pd-standard" // PdSsd disktype string PdSsd = "pd-ssd" // PdBalanced disktype string PdBalanced = "pd-balanced" // PdExtreme disktype string PdExtreme = "pd-extreme" // HyperdiskExtreme disktype string HyperdiskExtreme = "hyperdisk-extreme" // HyperdiskThroughput disktype string HyperdiskThroughput = "hyperdisk-throughput" // HyperdiskBalanced disktype string HyperdiskBalanced = "hyperdisk-balanced" )
Variables ¶
This section is empty.
Functions ¶
func PrintTests ¶
func PrintTests(ctx context.Context, storageClient *storage.Client, testWorkflows []*TestWorkflow, project, zone, gcsPath, localPath string)
PrintTests prints all test workflows.
func ValidateTests ¶
func ValidateTests(ctx context.Context, storageClient *storage.Client, testWorkflows []*TestWorkflow, project, zone, gcsPath, localPath string) error
ValidateTests validates all test workflows.
Types ¶
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network represent network used by vm in setup.go.
func (*Network) CreateFirewallRule ¶
CreateFirewallRule create firewall rule.
func (*Network) CreateSubnetwork ¶
func (n *Network) CreateSubnetwork(name string, ipRange string) (*Subnetwork, error)
CreateSubnetwork creates custom subnetwork. Using AddCustomNetwork method provided by TestVM to config network on vm
type Subnetwork ¶
type Subnetwork struct {
// contains filtered or unexported fields
}
Subnetwork represent subnetwork used by vm in setup.go.
func (Subnetwork) AddSecondaryRange ¶
func (s Subnetwork) AddSecondaryRange(rangeName, ipRange string)
AddSecondaryRange add secondary IP range to Subnetwork
func (*Subnetwork) SetPurpose ¶
func (s *Subnetwork) SetPurpose(purpose string)
SetPurpose sets the subnetwork purpose
func (*Subnetwork) SetRegion ¶
func (s *Subnetwork) SetRegion(region string)
SetRegion sets the subnetwork region
func (*Subnetwork) SetRole ¶
func (s *Subnetwork) SetRole(role string)
SetRole sets the subnetwork role
type TestSuites ¶
type TestSuites struct { XMLName xml.Name `xml:"testsuites"` Name string `xml:"name,attr"` Errors int `xml:"errors,attr"` Failures int `xml:"failures,attr"` Disabled int `xml:"disabled,attr"` Skipped int `xml:"skipped,attr"` Tests int `xml:"tests,attr"` Time float64 `xml:"time,attr"` TestSuite []*testSuite `xml:"testsuite"` }
TestSuites represent a collection of test cases.
type TestVM ¶
type TestVM struct {
// contains filtered or unexported fields
}
TestVM is a test VM.
func (*TestVM) AddAliasIPRanges ¶
AddAliasIPRanges add alias ip range to current test VMs.
func (*TestVM) AddCustomNetwork ¶
func (t *TestVM) AddCustomNetwork(network *Network, subnetwork *Subnetwork) error
AddCustomNetwork add current test VMs in workflow using provided network and subnetwork. If subnetwork is empty, not using subnetwork, in this case network has to be in auto mode VPC.
func (*TestVM) AddMetadata ¶
AddMetadata adds the specified key:value pair to metadata during VM creation.
func (*TestVM) EnableConfidentialInstance ¶
func (t *TestVM) EnableConfidentialInstance()
EnableConfidentialInstance enabled CVM features for the instance.
func (*TestVM) EnableSecureBoot ¶
func (t *TestVM) EnableSecureBoot()
EnableSecureBoot make the current test VMs in workflow with secure boot.
func (*TestVM) ForceMachineType ¶
ForceMachineType sets the machine type for the test VM. This will override the machine_type flag in the CIT wrapper, and should only be used when a test absolutely requires a specific machine shape.
func (*TestVM) ForceZone ¶
ForceZone sets the zone for the test vm. This will override the zone option from the CIT wrapper and and should only be used when a test requires a specific zone.
func (*TestVM) Reboot ¶
Reboot stops the VM, waits for it to shutdown, then starts it again. Your test package must handle being run twice.
func (*TestVM) ResizeDiskAndReboot ¶
ResizeDiskAndReboot resize the disk of the current test VMs and reboot
func (*TestVM) Resume ¶
Resume waits for the vm to be SUSPENDED, then resumes it. It does not handle suspension.
func (*TestVM) RunTests ¶
RunTests runs only the named tests on the testVM.
From go help test:
-run regexp Run only those tests and examples matching the regular expression. For tests, the regular expression is split by unbracketed slash (/) characters into a sequence of regular expressions, and each part of a test's identifier must match the corresponding element in the sequence, if any. Note that possible parents of matches are run too, so that -run=X/Y matches and runs and reports the result of all tests matching X, even those without sub-tests matching Y, because it must run them to look for those sub-tests.
func (*TestVM) SetMinCPUPlatform ¶
SetMinCPUPlatform sets the minimum CPU platform of the instance.
func (*TestVM) SetNetworkPerformanceTier ¶
SetNetworkPerformanceTier sets the performance tier of the VM. The tier must be one of "DEFAULT" or "TIER_1"
func (*TestVM) SetPrivateIP ¶
SetPrivateIP set IPv4 internal IP address for target network to the current test VMs.
func (*TestVM) SetShutdownScript ¶
SetShutdownScript sets the `shutdown-script` metadata key for a non-Windows VM.
func (*TestVM) SetShutdownScriptURL ¶
SetShutdownScriptURL sets the`shutdown-script-url` metadata key for a non-Windows VM.
func (*TestVM) SetStartupScript ¶
SetStartupScript sets the `startup-script` metadata key for a VM. On Windows VMs, this script does not run on startup: different guest attributes must be set.
func (*TestVM) SetWindowsShutdownScript ¶
SetWindowsShutdownScript sets the `windows-shutdown-script-ps1` metadata key for a Windows VM.
func (*TestVM) SetWindowsShutdownScriptURL ¶
SetWindowsShutdownScriptURL sets the`windows-shutdown-script-url` metadata key for a Windows VM.
func (*TestVM) SetWindowsStartupScript ¶
SetWindowsStartupScript sets the `windows-startup-script-ps1` metadata key for a VM.
type TestWorkflow ¶
type TestWorkflow struct { Name string // Client is a shared client for the compute service. Client daisycompute.Client // Image is the image under test Image *compute.Image // ImageURL will be the partial URL of a GCE image. ImageURL string // MachineType is the machine type to be used for the test. This can be overridden by individual test suites. MachineType *compute.MachineType Project *compute.Project Zone *compute.Zone // contains filtered or unexported fields }
TestWorkflow defines a test workflow which creates at least one test VM.
func NewTestWorkflow ¶
func NewTestWorkflow(client daisycompute.Client, computeEndpointOverride, name, image, timeout, project, zone, x86Shape string, arm64Shape string) (*TestWorkflow, error)
NewTestWorkflow returns a new TestWorkflow.
func (*TestWorkflow) AddSSHKey ¶
func (t *TestWorkflow) AddSSHKey(user string) (string, error)
AddSSHKey generate ssh key pair and return public key.
func (*TestWorkflow) CreateNetwork ¶
func (t *TestWorkflow) CreateNetwork(networkName string, autoCreateSubnetworks bool) (*Network, error)
CreateNetwork creates custom network. Using AddCustomNetwork method provided by TestVM to config network on vm
func (*TestWorkflow) CreateTestVM ¶
func (t *TestWorkflow) CreateTestVM(name string) (*TestVM, error)
CreateTestVM adds the necessary steps to create a VM with the specified name to the workflow.
func (*TestWorkflow) CreateTestVMBeta ¶
func (t *TestWorkflow) CreateTestVMBeta(name string) (*TestVM, error)
CreateTestVMBeta adds the necessary steps to create a VM with the specified name from the compute beta API to the workflow.
func (*TestWorkflow) CreateTestVMFromInstanceBeta ¶
func (t *TestWorkflow) CreateTestVMFromInstanceBeta(i *daisy.InstanceBeta, disks []*compute.Disk) (*TestVM, error)
CreateTestVMFromInstanceBeta creates a test vm struct to run CIT suites on from the given daisy instancebeta and adds it to the test workflow.
func (*TestWorkflow) CreateTestVMMultipleDisks ¶
func (t *TestWorkflow) CreateTestVMMultipleDisks(disks []*compute.Disk, instanceParams *daisy.Instance) (*TestVM, error)
CreateTestVMMultipleDisks adds the necessary steps to create a VM with the specified name to the workflow.
func (*TestWorkflow) LockProject ¶
func (t *TestWorkflow) LockProject()
LockProject indicates this test modifies project-level data and must have exclusive use of the project.
func (*TestWorkflow) Skip ¶
func (t *TestWorkflow) Skip(message string)
Skip marks a test workflow to be skipped.
func (*TestWorkflow) SkippedMessage ¶
func (t *TestWorkflow) SkippedMessage() string
SkippedMessage returns the skip reason message for the workflow.
func (*TestWorkflow) WaitForDisksQuota ¶
func (t *TestWorkflow) WaitForDisksQuota(qa *daisy.QuotaAvailable) error
WaitForDisksQuota appends a list of quotas to the wait for disk quota step. Quotas with a blank region will be populated with the region corresponding to the workflow zone.
func (*TestWorkflow) WaitForVMQuota ¶
func (t *TestWorkflow) WaitForVMQuota(qa *daisy.QuotaAvailable) error
WaitForVMQuota appends a list of quotas to the wait for vm quota step. Quotas with a blank region will be populated with the region corresponding to the workflow zone.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
test_suites
|
|
livemigrate
Package livemigrate tests standard live migration, not confidential vm live migrate.
|
Package livemigrate tests standard live migration, not confidential vm live migrate. |