File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -33,22 +33,22 @@ const (
3333
3434type Provider struct {
3535 client.Client
36+ config * interfaces.Config
3637}
3738
3839var _ interfaces.Provider = (* Provider )(nil )
3940
4041func New (c client.Client ) interfaces.Provider {
4142 return & Provider {
42- c ,
43+ Client : c ,
44+ config : nil ,
4345 }
4446}
4547
46- var userAutoConfig * interfaces.Config
47-
4848func (ac * Provider ) EnsureCertificateSecret (ctx context.Context , secretKey client.ObjectKey ,
4949 cfg * interfaces.Config ) error {
5050 // Save the user defined AutoConfig so that it can be returned from GetCertificateConfig
51- userAutoConfig = cfg
51+ ac . config = cfg
5252
5353 var secret corev1.Secret
5454 err := ac .Get (ctx , secretKey , & secret )
@@ -162,8 +162,8 @@ func (ac *Provider) GetCertificateConfig(ctx context.Context,
162162 return nil , fmt .Errorf ("failed to get certificate: %w" , err )
163163 }
164164
165- if userAutoConfig != nil {
166- return userAutoConfig , nil
165+ if ac . config != nil {
166+ return ac . config , nil
167167 }
168168
169169 return nil , fmt .Errorf ("failed to get user-defined autoConfig" )
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ func TestAutoProvider(t *testing.T) {
8080 cl := cfg .Client ()
8181 acProvider := auto .New (cl .Resources ().GetControllerRuntimeClient ())
8282 secretKey := client.ObjectKey {Name : cmCertificateName , Namespace : cmCertificateNamespace }
83+ err := acProvider .EnsureCertificateSecret (ctx , secretKey , cmConfig )
84+ if err != nil {
85+ t .Fatalf ("Auto Provider Certificate could not be created: %v" , err )
86+ }
8387 config , err := acProvider .GetCertificateConfig (ctx , secretKey )
8488 if err != nil {
8589 t .Fatalf ("Auto Certificate not found: %v" , err )
@@ -183,6 +187,14 @@ func TestClusterAutoCertCreation(t *testing.T) {
183187 ); err != nil {
184188 t .Fatalf ("timed out waiting for certificate: %s" , err )
185189 }
190+
191+ return ctx
192+ },
193+ )
194+
195+ feature .Assess ("Wait for StatefulSet readiness" ,
196+ func (ctx context.Context , t * testing.T , c * envconf.Config ) context.Context {
197+ waitForSTSReadiness (t , c , etcdClusterName , size )
186198 return ctx
187199 },
188200 )
You can’t perform that action at this time.
0 commit comments