adjust for tests

This commit is contained in:
Chris Lu 2020-11-08 23:02:09 -08:00
parent fab237e7ef
commit 5a4f61591d
5 changed files with 22 additions and 4 deletions

View File

@ -126,6 +126,8 @@ type MasterSpec struct {
GarbageThreshold *string `json:"garbageThreshold,omitempty"`
PulseSeconds *int32 `json:"pulseSeconds,omitempty"`
DefaultReplication *string `json:"defaultReplication,omitempty"`
// only for testing
ConcurrentStart *bool `json:"concurrentStart,omitempty"`
}
// VolumeSpec is the spec for volume servers

View File

@ -185,6 +185,11 @@ func (in *MasterSpec) DeepCopyInto(out *MasterSpec) {
*out = new(string)
**out = **in
}
if in.ConcurrentStart != nil {
in, out := &in.ConcurrentStart, &out.ConcurrentStart
*out = new(bool)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MasterSpec.

View File

@ -2123,6 +2123,9 @@ spec:
description: Annotations of the component. Merged into the cluster-level
annotations if non-empty
type: object
concurrentStart:
description: only for testing
type: boolean
config:
description: Config in raw toml string
type: string

View File

@ -35,8 +35,10 @@ func (r *SeaweedReconciler) ensureMaster(seaweedCR *seaweedv1.Seaweed) (done boo
return
}
if done, result, err = r.waitForMasterStatefulSet(seaweedCR); done {
return
if !*seaweedCR.Spec.Master.ConcurrentStart {
if done, result, err = r.waitForMasterStatefulSet(seaweedCR); done {
return
}
}
return

View File

@ -15,6 +15,11 @@ import (
seaweedv1 "github.com/seaweedfs/seaweedfs-operator/api/v1"
)
var (
TrueValue = true
FalseVallue = false
)
var _ = Describe("Seaweed Controller", func() {
Context("Basic Functionality", func() {
It("Should create StatefulSets", func() {
@ -34,10 +39,11 @@ var _ = Describe("Seaweed Controller", func() {
Name: name,
},
Spec: seaweedv1.SeaweedSpec{
Image: "chrislusf/seaweedfs:2.07",
Image: "chrislusf/seaweedfs:2.09",
VolumeServerDiskCount: 1,
Master: &seaweedv1.MasterSpec{
Replicas: 3,
Replicas: 3,
ConcurrentStart: &TrueValue,
},
Volume: &seaweedv1.VolumeSpec{
Replicas: 1,