From df09495abfafa9dacbfef8657ca076fa827e4725 Mon Sep 17 00:00:00 2001 From: Anthony Lu <67125539+koln67@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:00:05 -0700 Subject: [PATCH] Move some tests from imagevalidation to packagevalidation (#880) * Move some tests from imagevalidation to packagevalidation * Convert imagevalidation to hostnamevalidation * gofmt * Rename image validation test go file --- imagetest/cmd/manager/main.go | 11 ++++++++--- .../hostname_validation_test.go} | 2 +- .../linux_license_test.go | 2 +- .../setup.go | 6 +++--- .../clock_test.go | 2 +- .../license_test.go | 2 +- .../package_test.go | 2 +- .../test_suites/packagevalidation/setup.go | 17 +++++++++++++++++ 8 files changed, 33 insertions(+), 11 deletions(-) rename imagetest/test_suites/{imagevalidation/image_validation_test.go => hostnamevalidation/hostname_validation_test.go} (99%) rename imagetest/test_suites/{imagevalidation => hostnamevalidation}/linux_license_test.go (98%) rename imagetest/test_suites/{imagevalidation => hostnamevalidation}/setup.go (77%) rename imagetest/test_suites/{imagevalidation => packagevalidation}/clock_test.go (98%) rename imagetest/test_suites/{imagevalidation => packagevalidation}/license_test.go (99%) rename imagetest/test_suites/{imagevalidation => packagevalidation}/package_test.go (98%) create mode 100644 imagetest/test_suites/packagevalidation/setup.go diff --git a/imagetest/cmd/manager/main.go b/imagetest/cmd/manager/main.go index 3af225072..6674f472a 100644 --- a/imagetest/cmd/manager/main.go +++ b/imagetest/cmd/manager/main.go @@ -15,13 +15,14 @@ import ( "github.com/GoogleCloudPlatform/guest-test-infra/imagetest" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/cvm" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/disk" + "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/hostnamevalidation" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/hotattach" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/imageboot" - "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/imagevalidation" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/metadata" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/network" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/networkperf" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/oslogin" + "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/packagevalidation" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/security" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/shapevalidation" "github.com/GoogleCloudPlatform/guest-test-infra/imagetest/test_suites/sql" @@ -139,8 +140,8 @@ func main() { networkperf.TestSetup, }, { - imagevalidation.Name, - imagevalidation.TestSetup, + hostnamevalidation.Name, + hostnamevalidation.TestSetup, }, { imageboot.Name, @@ -166,6 +167,10 @@ func main() { shapevalidation.Name, shapevalidation.TestSetup, }, + { + packagevalidation.Name, + packagevalidation.TestSetup, + }, { storageperf.Name, storageperf.TestSetup, diff --git a/imagetest/test_suites/imagevalidation/image_validation_test.go b/imagetest/test_suites/hostnamevalidation/hostname_validation_test.go similarity index 99% rename from imagetest/test_suites/imagevalidation/image_validation_test.go rename to imagetest/test_suites/hostnamevalidation/hostname_validation_test.go index 32eafc28e..3772fe722 100644 --- a/imagetest/test_suites/imagevalidation/image_validation_test.go +++ b/imagetest/test_suites/hostnamevalidation/hostname_validation_test.go @@ -1,7 +1,7 @@ //go:build cit // +build cit -package imagevalidation +package hostnamevalidation import ( "crypto/md5" diff --git a/imagetest/test_suites/imagevalidation/linux_license_test.go b/imagetest/test_suites/hostnamevalidation/linux_license_test.go similarity index 98% rename from imagetest/test_suites/imagevalidation/linux_license_test.go rename to imagetest/test_suites/hostnamevalidation/linux_license_test.go index d6f62dfeb..77f933ac6 100644 --- a/imagetest/test_suites/imagevalidation/linux_license_test.go +++ b/imagetest/test_suites/hostnamevalidation/linux_license_test.go @@ -1,7 +1,7 @@ //go:build cit // +build cit -package imagevalidation +package hostnamevalidation import ( "testing" diff --git a/imagetest/test_suites/imagevalidation/setup.go b/imagetest/test_suites/hostnamevalidation/setup.go similarity index 77% rename from imagetest/test_suites/imagevalidation/setup.go rename to imagetest/test_suites/hostnamevalidation/setup.go index 1d082e483..e0c600aa4 100644 --- a/imagetest/test_suites/imagevalidation/setup.go +++ b/imagetest/test_suites/hostnamevalidation/setup.go @@ -1,9 +1,9 @@ -package imagevalidation +package hostnamevalidation import "github.com/GoogleCloudPlatform/guest-test-infra/imagetest" // Name is the name of the test package. It must match the directory name. -var Name = "imagevalidation" +var Name = "hostnamevalidation" // TestSetup sets up the test workflow. func TestSetup(t *imagetest.TestWorkflow) error { @@ -11,7 +11,7 @@ func TestSetup(t *imagetest.TestWorkflow) error { if err != nil { return err } - vm1.RunTests("TestHostname|TestFQDN|TestHostKeysGeneratedOnce|TestArePackagesLegal|TestStandardPrograms|TestGuestPackages|TestNTPService|TestHostsFile") + vm1.RunTests("TestHostname|TestFQDN|TestHostKeysGeneratedOnce|TestHostsFile") vm2, err := t.CreateTestVM("vm2.custom.domain") if err != nil { diff --git a/imagetest/test_suites/imagevalidation/clock_test.go b/imagetest/test_suites/packagevalidation/clock_test.go similarity index 98% rename from imagetest/test_suites/imagevalidation/clock_test.go rename to imagetest/test_suites/packagevalidation/clock_test.go index d84221150..58697e68e 100644 --- a/imagetest/test_suites/imagevalidation/clock_test.go +++ b/imagetest/test_suites/packagevalidation/clock_test.go @@ -1,7 +1,7 @@ //go:build cit // +build cit -package imagevalidation +package packagevalidation import ( "os/exec" diff --git a/imagetest/test_suites/imagevalidation/license_test.go b/imagetest/test_suites/packagevalidation/license_test.go similarity index 99% rename from imagetest/test_suites/imagevalidation/license_test.go rename to imagetest/test_suites/packagevalidation/license_test.go index d4587eabd..3986a420c 100644 --- a/imagetest/test_suites/imagevalidation/license_test.go +++ b/imagetest/test_suites/packagevalidation/license_test.go @@ -1,7 +1,7 @@ //go:build cit // +build cit -package imagevalidation +package packagevalidation import ( "fmt" diff --git a/imagetest/test_suites/imagevalidation/package_test.go b/imagetest/test_suites/packagevalidation/package_test.go similarity index 98% rename from imagetest/test_suites/imagevalidation/package_test.go rename to imagetest/test_suites/packagevalidation/package_test.go index 4709f52e1..6cb25fe99 100644 --- a/imagetest/test_suites/imagevalidation/package_test.go +++ b/imagetest/test_suites/packagevalidation/package_test.go @@ -1,7 +1,7 @@ //go:build cit // +build cit -package imagevalidation +package packagevalidation import ( "bytes" diff --git a/imagetest/test_suites/packagevalidation/setup.go b/imagetest/test_suites/packagevalidation/setup.go new file mode 100644 index 000000000..4f91ac181 --- /dev/null +++ b/imagetest/test_suites/packagevalidation/setup.go @@ -0,0 +1,17 @@ +package packagevalidation + +import "github.com/GoogleCloudPlatform/guest-test-infra/imagetest" + +// Name is the name of the test package. It must match the directory name. +var Name = "packagevalidation" + +// TestSetup sets up the test workflow. +func TestSetup(t *imagetest.TestWorkflow) error { + vm1, err := t.CreateTestVM("vm1") + if err != nil { + return err + } + vm1.RunTests("TestArePackagesLegal|TestStandardPrograms|TestGuestPackages|TestNTPService") + + return nil +}