dashboard, cmd/makemac: add macOS 10.15 Catalina builder

Added the macOS 10.15 Catalina builder to the dashboard. Catalina builders should
use the Mojave guestid in vSphere 6.7 update 3 because the Catalina guestid is not
available in this version of vSphere. A Catalina builder will run on this version
of vSphere with the Mojave guestid. Modified the expected number of vm instances
running on Macstadium due to the addition of macOS 10.15 builders.

Updates golang/go#34748

Change-Id: If14f6e088afc05dd1783460f21907e9345e3c338
Reviewed-on: https://go-review.googlesource.com/c/build/+/207937
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/makemac/makemac.go b/cmd/makemac/makemac.go
index 6b3ae2e..1078471 100644
--- a/cmd/makemac/makemac.go
+++ b/cmd/makemac/makemac.go
@@ -228,7 +228,13 @@
 	case 15:
 		// Catalina. Requires vSphere 6.7 update 3.
 		// https://docs.macstadium.com/docs/vsphere-67-update-3
-		guestType = "darwin19_64Guest"
+		// vSphere 6.7 update 3 does not support the guestid `darwin19_64Guest` (which would be
+		// associated with macOS 10.15. It enables the creation of a macOS 10.15 vm via guestid
+		// `darwin18_64Guest`.
+		// TODO: Add a new GOS definition for darwin19_64 (macOS 10.15) in HWV >= 17
+		// https://github.com/vmware/open-vm-tools/commit/6297504ef9e139c68b65afe299136d041d690eeb
+		// TODO: investigate updating the guestid when we upgrade vSphere past version 6.7u3.
+		guestType = "darwin18_64Guest"
 	default:
 		return "", fmt.Errorf("unsupported makemac minor OS X version %d", minor)
 	}
diff --git a/dashboard/builders.go b/dashboard/builders.go
index a218248..d13bce1 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -481,7 +481,7 @@
 	},
 	"host-darwin-10_11": &HostConfig{
 		IsReverse: true,
-		ExpectNum: 7,
+		ExpectNum: 3,
 		Notes:     "MacStadium OS X 10.11 VM under VMWare ESXi",
 		env: []string{
 			"GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
@@ -501,7 +501,7 @@
 	},
 	"host-darwin-10_14": &HostConfig{
 		IsReverse: true,
-		ExpectNum: 7,
+		ExpectNum: 5,
 		Notes:     "MacStadium macOS Mojave (10.14) VM under VMWare ESXi",
 		env: []string{
 			"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.12.1
@@ -509,6 +509,16 @@
 		SSHUsername:     "gopher",
 		HermeticReverse: true, // we destroy the VM when done & let cmd/makemac recreate
 	},
+	"host-darwin-10_15": &HostConfig{
+		IsReverse: true,
+		ExpectNum: 6,
+		Notes:     "MacStadium macOS Catalina (10.15) VM under VMWare ESXi",
+		env: []string{
+			"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.12.1
+		},
+		SSHUsername:     "gopher",
+		HermeticReverse: true, // we destroy the VM when done & let cmd/makemac recreate
+	},
 	"host-linux-s390x": &HostConfig{
 		Notes:       "run by IBM",
 		OwnerGithub: "mundaym",
@@ -2070,6 +2080,12 @@
 		buildsRepo:        defaultPlusExp,
 	})
 	addBuilder(BuildConfig{
+		Name:              "darwin-amd64-10_15",
+		HostType:          "host-darwin-10_15",
+		shouldRunDistTest: macTestPolicy,
+		buildsRepo:        defaultPlusExp,
+	})
+	addBuilder(BuildConfig{
 		Name:              "darwin-amd64-nocgo",
 		HostType:          "host-darwin-10_14",
 		shouldRunDistTest: noTestDir,
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 4bb29ee..f480a87 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -472,6 +472,7 @@
 		{b("windows-386-2008", "exp"), both},
 		{b("windows-amd64-2016", "exp"), both},
 		{b("darwin-amd64-10_14", "exp"), onlyPost},
+		{b("darwin-amd64-10_15", "exp"), onlyPost},
 		// ... but not on most others:
 		{b("darwin-amd64-10_12", "exp"), none},
 		{b("freebsd-386-11_2", "exp"), none},
@@ -494,6 +495,7 @@
 		{b("darwin-amd64-10_11@go1.12", "net"), none},
 		{b("darwin-386-10_14@go1.11", "net"), none},
 
+		{b("darwin-amd64-10_15", "go"), onlyPost},
 		{b("darwin-amd64-10_14", "go"), onlyPost},
 		{b("darwin-amd64-10_12", "go"), onlyPost},
 		{b("darwin-amd64-10_11", "go"), onlyPost},
@@ -615,10 +617,10 @@
 		{"darwin-amd64-10_11", "test:foo", postSubmit, false},
 		{"darwin-amd64-10_12", "test:foo", postSubmit, false},
 		{"darwin-amd64-10_14", "test:foo", postSubmit, false},
-		{"darwin-amd64-10_14", "test:foo", postSubmit, false},
 		{"darwin-amd64-10_14", "reboot", postSubmit, false},
 		{"darwin-amd64-10_14", "api", postSubmit, false},
 		{"darwin-amd64-10_14", "codewalk", postSubmit, false},
+		{"darwin-amd64-10_15", "test:foo", postSubmit, false},
 	}
 	for _, tt := range tests {
 		bc, ok := Builders[tt.builder]
@@ -803,3 +805,18 @@
 	}
 
 }
+
+// TestExpectedMacstadiumVMCount ensures that only 20 instances of macOS virtual machines
+// are expected at MacStadium.
+// TODO: remove once the scheduler allocates VMs based on demand https://golang.org/issue/35698
+func TestExpectedMacstadiumVMCount(t *testing.T) {
+	got := 0
+	for host, config := range Hosts {
+		if strings.HasPrefix(host, "host-darwin-10_") {
+			got += config.ExpectNum
+		}
+	}
+	if got != 20 {
+		t.Fatalf("macstadium host count: got %d; want 20", got)
+	}
+}