Skip to content

Commit

Permalink
Fix unit tests and an error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyklyukin committed Sep 7, 2017
1 parent 589caf9 commit ad33866
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/spec/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (p *Postgresql) UnmarshalJSON(data []byte) error {
if tmp2.Spec.Clone.ClusterName != "" {
_, err := extractClusterName(tmp2.Spec.Clone.ClusterName, tmp2.Spec.TeamID)
if err != nil {
tmp2.Error = fmt.Errorf(" %s for the cluster to clone")
tmp2.Error = fmt.Errorf(" %s for the cluster to clone", err)
}
}
*p = tmp2
Expand Down
6 changes: 3 additions & 3 deletions pkg/spec/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var unmarshalCluster = []struct {
}
},
"clone" : {
"cluster": "batman"
"cluster": "acid-batman"
},
"patroni": {
"initdb": {
Expand Down Expand Up @@ -246,13 +246,13 @@ var unmarshalCluster = []struct {
},
},
Clone: CloneDescription{
ClusterName: "batman",
ClusterName: "acid-batman",
},
ClusterName: "testcluster1",
},
Error: nil,
},
[]byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"9.6","parameters":{"log_statement":"all","max_connections":"10","shared_buffers":"32MB"}},"volume":{"size":"5Gi","storageClass":"SSD"},"patroni":{"initdb":{"data-checksums":"true","encoding":"UTF8","locale":"en_US.UTF-8"},"pg_hba":["hostssl all all 0.0.0.0/0 md5","host all all 0.0.0.0/0 md5"],"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432},"resources":{"requests":{"cpu":"10m","memory":"50Mi"},"limits":{"cpu":"300m","memory":"3000Mi"}},"teamId":"ACID","allowedSourceRanges":["127.0.0.1/32"],"numberOfInstances":2,"users":{"zalando":["superuser","createdb"]},"maintenanceWindows":["Mon:01:00-06:00","Sat:00:00-04:00","05:00-05:15"],"clone":{"cluster":"batman"}}}`), nil},
[]byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"9.6","parameters":{"log_statement":"all","max_connections":"10","shared_buffers":"32MB"}},"volume":{"size":"5Gi","storageClass":"SSD"},"patroni":{"initdb":{"data-checksums":"true","encoding":"UTF8","locale":"en_US.UTF-8"},"pg_hba":["hostssl all all 0.0.0.0/0 md5","host all all 0.0.0.0/0 md5"],"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432},"resources":{"requests":{"cpu":"10m","memory":"50Mi"},"limits":{"cpu":"300m","memory":"3000Mi"}},"teamId":"ACID","allowedSourceRanges":["127.0.0.1/32"],"numberOfInstances":2,"users":{"zalando":["superuser","createdb"]},"maintenanceWindows":["Mon:01:00-06:00","Sat:00:00-04:00","05:00-05:15"],"clone":{"cluster":"acid-batman"}}}`), nil},
{
[]byte(`{"kind": "Postgresql","apiVersion": "acid.zalan.do/v1","metadata": {"name": "teapot-testcluster1"}, "spec": {"teamId": "acid"}}`),
Postgresql{
Expand Down

0 comments on commit ad33866

Please sign in to comment.