Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OVF e2e: Use Debian 11 for 3 disk test #1809

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ func TestSuite(
e2e.Wrapper,
}
for _, testType := range testTypes {
instanceExportUbuntu3DisksTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v][OVFInstanceExport] %v", testType, "Ubuntu 3 disks, one data disk larger than 10GB"))
instanceExportDebian3DisksTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v][OVFInstanceExport] %v", testType, "Debian 3 disks, one data disk larger than 10GB"))

testsMap[testType] = map[*junitxml.TestCase]func(
context.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, e2e.CLITestType){}
testsMap[testType][instanceExportUbuntu3DisksTestCase] = runInstanceOVFExportUbuntu3Disks
testsMap[testType][instanceExportDebian3DisksTestCase] = runInstanceOVFExportDebian3Disks
}

e2e.CLITestSuite(ctx, tswg, testSuites, logger, testSuiteRegex, testCaseRegex,
testProjectConfig, testSuiteName, testsMap)
}

func runInstanceOVFExportUbuntu3Disks(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
func runInstanceOVFExportDebian3Disks(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
testProjectConfig *testconfig.Project, testType e2e.CLITestType) {

buildID := path.RandString(10)
Expand All @@ -99,12 +99,11 @@ func runInstanceOVFExportUbuntu3Disks(ctx context.Context, testCase *junitxml.Te
props := &instanceOvfExportTestProperties{
instanceName: fmt.Sprintf("test-instance-ubuntu-3-disks-%v", buildID),
verificationStartupScript: loadScriptContent(
"scripts/ovf_import_test_ubuntu_3_disks.sh", logger),
"scripts/ovf_import_test_3_disks.sh", logger),
zone: testProjectConfig.TestZone,
expectedStartupOutput: "All tests passed!",
failureMatches: []string{"FAILED:", "TestFailed:"},
sourceGMI: "projects/compute-image-test-pool-001/global/machineImages/ubuntu-1604-three-disks-do-not-delete",
os: "ubuntu-1604",
sourceGMI: "projects/compute-image-test-pool-001/global/machineImages/debian-11-three-disks-do-not-delete",
destinationURI: fmt.Sprintf("gs://%v/%v/", exportBucket, exportPath),
exportBucket: exportBucket,
exportPath: exportPath,
Expand Down Expand Up @@ -250,15 +249,18 @@ func verifyExportedOVFUsingOVFImport(
verificationInstanceName := fmt.Sprintf("ovf-export-verification-instance--%v", props.buildID)
logger.Printf("Verifying exported OVF by importing it via OVF import as `%v`", verificationInstanceName)

ovfImportError := e2e.RunCliTool(logger, testCase, "gcloud", []string{
args := []string{
"beta", "compute", "instances", "import",
verificationInstanceName,
fmt.Sprintf("--source-uri=%v", props.destinationURI),
fmt.Sprintf("--os=%v", props.os),
fmt.Sprintf("--zone=%v", props.zone),
fmt.Sprintf("--project=%v", testProjectConfig.TestProjectID),
"--docker-image-tag=latest",
})
}
if props.os != "" {
args = append(args, fmt.Sprintf("--os=%v", props.os))
}
ovfImportError := e2e.RunCliTool(logger, testCase, "gcloud", args)
if ovfImportError != nil {
e2e.Failure(testCase, logger, fmt.Sprintf("Failed importing exported OVF as instance: %v", ovfImportError))
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func TestSuite(
e2e.GcloudGaLatestWrapperRelease,
}
for _, testType := range testTypes {
instanceImportUbuntu3DisksTestCaseNetworkSettingsName := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Ubuntu 3 disks, one data disk larger than 10GB, network setting (name only)"))
instanceImportDebian3DisksTestCaseNetworkSettingsName := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Debian 3 disks, one data disk larger than 10GB, network setting (name only)"))
instanceImportWindows2012R2TwoDisksNetworkSettingsPath := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Windows 2012 R2 two disks, network setting (path)"))
instanceImportWindows2016 := junitxml.NewTestCase(
Expand All @@ -95,7 +95,7 @@ func TestSuite(

testsMap[testType] = map[*junitxml.TestCase]func(
context.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, e2e.CLITestType){}
testsMap[testType][instanceImportUbuntu3DisksTestCaseNetworkSettingsName] = runOVFInstanceImportUbuntu3DisksNetworkSettingsName
testsMap[testType][instanceImportDebian3DisksTestCaseNetworkSettingsName] = runOVFInstanceImportDebian3DisksNetworkSettingsName
testsMap[testType][instanceImportWindows2012R2TwoDisksNetworkSettingsPath] = runOVFInstanceImportWindows2012R2TwoDisksNetworkSettingsPath
testsMap[testType][instanceImportWindows2016] = runOVFInstanceImportWindows2016
testsMap[testType][instanceImportWindows2008R2FourNICs] = runOVFInstanceImportWindows2008R2FourNICs
Expand Down Expand Up @@ -178,20 +178,20 @@ func fallbackWhenSSDQuotaExhausted(ctx context.Context, testCase *junitxml.TestC
runOVFInstanceImportTest(ctx, buildTestArgs(props, testProjectConfig)[testType], testType, testProjectConfig, logger, testCase, props)
}

func runOVFInstanceImportUbuntu3DisksNetworkSettingsName(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
func runOVFInstanceImportDebian3DisksNetworkSettingsName(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
testProjectConfig *testconfig.Project, testType e2e.CLITestType) {

suffix := path.RandString(5)
props := &ovfInstanceImportTestProperties{
instanceName: fmt.Sprintf("test-instance-ubuntu-3-disks-%v", suffix),
OvfImportTestProperties: ovfimporttestsuite.OvfImportTestProperties{
VerificationStartupScript: ovfimporttestsuite.LoadScriptContent(
"scripts/ovf_import_test_ubuntu_3_disks.sh", logger),
"scripts/ovf_import_test_3_disks.sh", logger),
Zone: testProjectConfig.TestZone,
ExpectedStartupOutput: "All tests passed!",
FailureMatches: []string{"FAILED:", "TestFailed:"},
SourceURI: fmt.Sprintf("gs://%v/ova/ubuntu-1604-three-disks", ovaBucket),
Os: "ubuntu-1604",
SourceURI: fmt.Sprintf("gs://%v/ova/debian-11-three-disks.ova", ovaBucket),
Os: "debian-11",
MachineType: "n1-standard-4",
Network: fmt.Sprintf("%v-vpc-1", testProjectConfig.TestProjectID),
Subnet: fmt.Sprintf("%v-subnet-1", testProjectConfig.TestProjectID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ func TestSuite(
e2e.GcloudBetaLatestWrapperLatest,
}
for _, testType := range testTypes {
machineImageImportUbuntu3DisksNetworkSettingsNameTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Ubuntu 3 disks, one data disk larger than 10GB, Network setting (name only)"))
machineImageImportDebian3DisksNetworkSettingsNameTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Debian 3 disks, one data disk larger than 10GB, Network setting (name only)"))
machineImageImportWindows2012R2TwoDisksNetworkSettingsPathTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Windows 2012 R2 two disks, Network setting (path)"))
machineImageImportStorageLocationTestCase := junitxml.NewTestCase(
testSuiteName, fmt.Sprintf("[%v] %v", testType, "Centos 7.4, Storage location"))

testsMap[testType] = map[*junitxml.TestCase]func(
context.Context, *junitxml.TestCase, *log.Logger, *testconfig.Project, e2e.CLITestType){}
testsMap[testType][machineImageImportUbuntu3DisksNetworkSettingsNameTestCase] = runOVFMachineImageImportUbuntu3DisksNetworkSettingsName
testsMap[testType][machineImageImportDebian3DisksNetworkSettingsNameTestCase] = runOVFMachineImageImportDebian3DisksNetworkSettingsName
testsMap[testType][machineImageImportWindows2012R2TwoDisksNetworkSettingsPathTestCase] = runOVFMachineImageImportWindows2012R2TwoDisksNetworkSettingsPath
testsMap[testType][machineImageImportStorageLocationTestCase] = runOVFMachineImageImportCentos74StorageLocation
}
Expand All @@ -114,20 +114,20 @@ func TestSuite(
testProjectConfig, testSuiteName, testsMap)
}

func runOVFMachineImageImportUbuntu3DisksNetworkSettingsName(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
func runOVFMachineImageImportDebian3DisksNetworkSettingsName(ctx context.Context, testCase *junitxml.TestCase, logger *log.Logger,
testProjectConfig *testconfig.Project, testType e2e.CLITestType) {

suffix := path.RandString(5)
props := &ovfMachineImageImportTestProperties{
machineImageName: fmt.Sprintf("test-machine-image-ubuntu-3-disks-%v", suffix),
OvfImportTestProperties: ovfimporttestsuite.OvfImportTestProperties{
VerificationStartupScript: ovfimporttestsuite.LoadScriptContent(
"scripts/ovf_import_test_ubuntu_3_disks.sh", logger),
"scripts/ovf_import_test_3_disks.sh", logger),
Zone: testProjectConfig.TestZone,
ExpectedStartupOutput: "All tests passed!",
FailureMatches: []string{"TestFailed:"},
SourceURI: fmt.Sprintf("gs://%v/ova/ubuntu-1604-three-disks", ovaBucket),
Os: "ubuntu-1604",
SourceURI: fmt.Sprintf("gs://%v/ova/debian-11-three-disks.ova", ovaBucket),
Os: "debian-11",
InstanceMetadata: skipOSConfigMetadata,
MachineType: "n1-standard-4",
Network: fmt.Sprintf("%v-vpc-1", testProjectConfig.TestProjectID),
Expand Down