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

multizone support fix tests #24

Merged
merged 2 commits into from
Aug 10, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions internals/cron/cloudfoundry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
)

func TestGetCommentString(t *testing.T) {
request := ibmcloud.ClusterRequest{
DataCenter: "dal10",
request := ibmcloud.ScheduleRequest{
DataCenters: []string{"dal10"},
MachineType: "4X16",
MasterVersion: "iks16.7",
WorkerNum: 1,
}

createRequest := ibmcloud.CreateClusterRequest{
ClusterRequest: request,
scheduleRequest := ibmcloud.ScheduleClusterRequest{
ScheduleRequest: request,
}

schedule := ibmcloud.Schedule{
Count: "5",
CreateRequest: createRequest,
EventName: "mofisapp",
Password: "ikslab",
Count: "5",
ScheduleRequest: scheduleRequest,
EventName: "mofisapp",
Password: "ikslab",
}

comment, err := getCommentString(schedule, "../../templates/message.gotmpl")
Expand Down
9 changes: 5 additions & 4 deletions internals/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ func checkCloudant() {
// for each cluster loop through and create cluster, ignore error for now.
for i := 1; i <= count; i++ {
datacenters := schedule.ScheduleRequest.ScheduleRequest.DataCenters
vlans, err := session.GetDatacenterVlan()
datacenter := datacenters[i%len(datacenters)]
vlans, err := session.GetDatacenterVlan(datacenter)
if err != nil {
// could not get vlan
// skip the scheduling
Expand Down Expand Up @@ -248,13 +249,13 @@ func checkCloudant() {
schedule.Clusters = append(schedule.Clusters, response.ID)

for _, tag := range tags {
_, err := session.SetClusterTag(tag, response.ID, schedule.CreateRequest.ResourceGroup)
_, err := session.SetClusterTag(tag, response.ID, schedule.ScheduleRequest.ResourceGroup)
if err != nil {
log.Println("error setting tag : investigate ", schedule.CreateRequest.ClusterRequest.Name, err)
log.Println("error setting tag : investigate ", schedule.ScheduleRequest.ScheduleRequest.Name, err)
hasErrors = true
schedError := ScheduleError{
Error: err,
Message: fmt.Sprintf("Error creting tag %s for cluster %s", tag, schedule.CreateRequest.ClusterRequest.Name),
Message: fmt.Sprintf("Error creting tag %s for cluster %s", tag, schedule.ScheduleRequest.ScheduleRequest.Name),
}
emailData.Errors = append(emailData.Errors, schedError)
continue
Expand Down
6 changes: 3 additions & 3 deletions templates/message.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Key: `{{ .Password }}`

Region: {{ .CreateRequest.ClusterRequest.DataCenter }}
Region: {{ .ScheduleRequest.ScheduleRequest.DataCenters }}
Clusters: {{ .Count }}
Workers: {{ .CreateRequest.ClusterRequest.WorkerNum }} x {{ $.CreateRequest.ClusterRequest.MachineType }}
K8s Version: {{ .CreateRequest.ClusterRequest.MasterVersion }}
Workers: {{ .ScheduleRequest.ScheduleRequest.WorkerNum }} x {{ $.ScheduleRequest.ScheduleRequest.MachineType }}
K8s Version: {{ .ScheduleRequest.ScheduleRequest.MasterVersion }}

## Note
- Please be sure to click: `Prefill Cache` button on the URL before your lab
Expand Down