This commit is contained in:
Murat Kabilov 2017-05-24 18:39:04 +02:00
parent 20e343ebc9
commit ac92696d3b
3 changed files with 11 additions and 11 deletions

View File

@ -95,7 +95,7 @@ type PostgresqlList struct {
}
var alphaRegexp = regexp.MustCompile("^[a-zA-Z]*$")
var weekdays = map[string]int{"Sun":0, "Mon":1, "Tue":2, "Wed":3, "Thu":4, "Fri":5, "Sat":6}
var weekdays = map[string]int{"Sun": 0, "Mon": 1, "Tue": 2, "Wed": 3, "Thu": 4, "Fri": 5, "Sat": 6}
func ParseTime(s string) (t time.Time, wd time.Weekday, wdProvided bool, err error) {
var timeLayout string
@ -170,7 +170,7 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error {
return fmt.Errorf("'From' time must be prior to the 'To' time")
}
if (int(got.StartWeekday) + 6) % 7 > (int(got.EndWeekday) + 6) % 7 {
if (int(got.StartWeekday)+6)%7 > (int(got.EndWeekday)+6)%7 {
return fmt.Errorf("'From' weekday must be prior to the 'To' weekday")
}

View File

@ -1,11 +1,11 @@
package spec
import (
"bytes"
"encoding/json"
"reflect"
"testing"
"time"
"encoding/json"
"bytes"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1"
@ -178,9 +178,9 @@ var clExp = Postgresql{
PostgresqlParam: PostgresqlParam{
PgVersion: "9.6",
Parameters: map[string]string{
"shared_buffers": "32MB",
"shared_buffers": "32MB",
"max_connections": "10",
"log_statement": "all",
"log_statement": "all",
},
},
Volume: Volume{
@ -206,14 +206,14 @@ var clExp = Postgresql{
TeamID: "ACID",
AllowedSourceRanges: []string{"127.0.0.1/32"},
NumberOfInstances: 2,
Users: map[string]UserFlags{"zalando": UserFlags{"superuser", "createdb"}},
MaintenanceWindows: []MaintenanceWindow{MaintenanceWindow{
Users: map[string]UserFlags{"zalando": {"superuser", "createdb"}},
MaintenanceWindows: []MaintenanceWindow{{
StartWeekday: time.Monday,
StartTime: mustParseTime("01:00"),
EndTime: mustParseTime("06:00"),
EndWeekday: time.Sunday,
},
MaintenanceWindow{
{
StartWeekday: time.Saturday,
StartTime: mustParseTime("00:00"),
EndTime: mustParseTime("04:00"),

View File

@ -1,9 +1,9 @@
package spec
import (
"database/sql"
"fmt"
"strings"
"database/sql"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/types"